| Subject |
Re: replace command |
| From |
Gaetano D. <gaetanodd@hotmail.com> |
| Date |
Sat, 1 May 2021 18:41:36 +1000 |
| Newsgroups |
dbase.getting-started |
On 1/05/2021 17:28, Gaetano D. wrote:
> On 1/05/2021 17:03, AGOSTINHO wrote:
>> Dear Group
>> This does not seem to work, please how to make it work?
>> Thanks
>> this.rowset = this.clients1.rowset
>>
>> function ENTRYFIELD3_onChange()
>> if form.entryfield3.value=0.00
>> replace form.rowset.fields["cc"].value with "CASH"
>> endif
>> return
>>
> I would avoid to mix OODML and XML, since you use a rowset, forget
> about "replace", jsut assign the value to the field object.
>
> It might also be a good idea to rename the entryfields to something
> you can more easily rememeber, e.g. this.EF_SalesPrice is a new
> entryfield(this)
>
> That being said, I am not sure that the entryfield knows about the
> "form" object. You can try this:
>
>
> this.rowset = this.clients1.rowset
>
> function ENTRYFIELD3_onChange()
> if form.entryfield3.value=0.00
> form.rowset.fields["cc"].value ="CASH"
> form.rowset.save()
> endif
> return
>
>
> but I think you need to use the "parent" hierarchy to get to the
> form's rowset:
>
> function ENTRYFIELD3_onChange()
> if this.parent.entryfield3.value=0.00 // in this function, you
> are at the entryfield level of the hierarchy, the parent of the
> entryfield is the form - unless it's in a container, in that case, you
> need to go one more parent up...
> this.parent.rowset.fields["cc"].value ="CASH"
> this.parent.rowset.save()
> endif
> return
>
>
not XML but XDML or Xbase commands...
I just tried it and the entryfield event seems to be aware of the
form.rowset object, so I guess that option 1 (and akshat's option)
should work, but I was confused as to why it does work...
So I went to Ken's books and I think I found the answer... anything
instantiated with (this) in a form and its event handlers, e.g.
this.entryfield1 = new entryfield(this) and entryfield1's onchange event
would know what "form.rowset" is. Does that sound right, Ken?
Gaetano.
|
|