| Subject |
Re: replace command |
| From |
Ken Mayer <dbase@nospam.goldenstag.net> |
| Date |
Sat, 1 May 2021 08:21:32 -0700 |
| Newsgroups |
dbase.getting-started |
On 5/1/2021 1:41 AM, Gaetano D. wrote:
> 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?
Yeah, rowsets and such often don't know what "form" is because they can
be used across different forms/reports/etc, but visual controls have to
have parents, and so form.entryfield ...
Ken
--
*Ken Mayer*
Ken's dBASE Page: http://www.goldenstag.net/dbase
The dUFLP: http://www.goldenstag.net/dbase/index.htm#duflp
dBASE Books: http://www.goldenstag.net/dbase/Books/dBASEBooks.htm
dBASE Tutorial: http://www.goldenstag.net/dbase/Tutorial/00_Preface.htm
dBASE Web Tutorial: http://www.goldenstag.net/dbase/WebTutorial/00_Menu.htm
|
|