Quantcast
Channel: West Wind Message Board Messages
Viewing all articles
Browse latest Browse all 10393

Re: javascript updating object propertie

$
0
0
Re: javascript updating object propertie
FoxInCloud
Re: javascript updating object propertie
01/17/2012
01:37:16 AM
3ET03H54H Show this entire thread in new window
From:
To:
Attachments:
None
Tuvia,

I think I can understand your issue;

I this use case, you would expect that changing the HTML element's .value would trigger sending an event notification to the server, à la .ProgrammaticChange() in VFP.

As this does not happen automatically in the HTML DOM event model, you need to handle that by code.
I guess your JavaScript calendar has some callBack method when user chooses a new date;
Just implement this method like follows:

$('form1_scx-text1').simulate('blur');

This code will execute the blur() event code of your <input type="text"> element, which sends the new date value to the Valid() method of the corresponding VFP object on the server.

HTH,
ThN

On my form I am using the calendarview.js popup calendar designed to work with prototype. It seems to work fine except for one sticking point.

On the form I have an image, say form1_scx-image1. I have a text field with a date, say form1_scx-text1.

In the form's wcHTMLgen method I added

WITH toHTML AS awHTMLGen OF awHTML.prg .cScriptJSadd("Calendar.setup( {dateField: 'form1_scx-text1', triggerElement: 'form1_scx-image1' });") ENDWITH

Works great. When I click the image, the calendar comes up, I pick a date, and that data gets filled into the .value property of text1. The JS code does something like:

. . . . figure the date and format it . . . . datefield.value = newDate

The form appears correct and the text field appears to have the new date in it. But appearances are deceiving. Somehow FiC does not recognize that the value of text1 has changed, and returns whatever the original value was. Or if I type in a value. But even though the HTML text field is displaying the new value correctly, and vaue is in wcpropSave, you get the new value if you check the HTML text1.value and you get the old value if you check in VFP the text1.value.

IOW despite changing the attribute in the HTML.JS, how do I get VFP/FiC cloud to recognize that change?

p.s. (Thierry: you can see this on the search in iptest)




Viewing all articles
Browse latest Browse all 10393

Trending Articles