Subject Re: LOGICAL ERROR
From Akshat Kapoor <akshat.kapoor@kapoorsons.in>
Date Sun, 11 Mar 2018 22:31:24 +0530
Newsgroups dbase.getting-started

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