Subject Re: LOGICAL ERROR
From Andy Taylor <andy.taylor@which.net>
Date Tue, 13 Mar 2018 04:53:17 -0400
Newsgroups dbase.getting-started

Akshat, Mustansir

Programmatic changes of form control values will not fire the onChange events. They are only fired by user interactions.

If this were not so the following code would loop endlessly:
function onChangeSpinbox1
   form.Spinbox1.value += 1
   return

Andy


Andy

> On 11/03/2018 19:22, Mustansir Ghor wrote:
> > Dear
> >
> > I seem to get confused many times use of 'this' object.  When following PBRCANCEL_onclick() is executed, there is change in value of form.eamount. Therefore function  Eamount-Onchange() will execute. On its execution what will 'this' refer to ?
> >
> > Best Regards
> > Mustansir
> >
> >   function PBRCANCEL_onClick()
> >    form.eamount.value=0
> >     form.cbregname.setfocus()
> >   return
> >
> >   function EAMOUNT_onChange()
> >          if this.value>0
> >          form.pbrcancel.enabled=true
> >          form.pbrsave.enabled=true
> >         else
> >          form.pbrcancel.enabled=false
> >          form.pbrsave.enabled=false
> >         endif
> >                 
> >    return
>
> Hi Mustansir,
> You are changing the value of form.eamount programmatically. I am not
> commenting if eamount_onchange will fire or not. But to be on the safe
> side I would prefer using form.eamount.value to be sure of which value I
> am refering to rather than this.value which usually refers to the value
> of object in focus.
>
> This may be due to my lack in experience in oops/flow of control but I
> prefer not to use this. / parent notation if avoidable.
>
> Regards
> Akshat