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

Re: javascript

$
0
0
Re: javascript
FoxInCloud
Re: javascript
02/13/2012
04:51:35 AM
3FK0AF1OE Show this entire thread in new window
Gratar Image based on email address
From:
To:
Attachments:
None

Excellent explanation, should be part of docs. Thank you.

An event may be EITHER processed on client side OR on server side OR ignored.
What you might do is process event on client side and, in your javascript function, based on a form property, decide whether event should be sent to server or not.

You might write something like:

PROCEDURE <event> IF m.thisForm.wlHTMLgen RETURN 'myHandler(event)' ELSE ... ENDIF PROCEDURE wcHTMLgen LPARAMETERS toHTML AS awHTMLGen OF awHTML.prg, tlInnerHTML && HTML renderer && [.F.] render container's inner HTML LOCAL lcScript TEXT TO lcScript TEXTMERGE NOSHOW FLAG 1 PRETEXT 3 function myHandler(event){ var form = $(''); if (form){ if (form.property === someValue) FoxInCloud.DOMevent(event); // send event to server for processing else { // process event on client side } } }; ENDTEXT toHTML.cScriptJSadd(m.lcScript) && How to update client side property somewhere in VFP code ... IF wlAjax() AJAX.cScriptJSadd(textmerge([$('').property = ;])) ENDIF ...



I want to do something simple with js, but I seem to be missing something.

In a VFP method connected to an event I can do this:

return "cooljsunction(param1,param2)

But mostly what we need to do is in the code of a method, test for something and then call js if needed. So I created a method on the form called js1. In that method I have:

if thisform.wlhtmlgen
return "cooljsfunction(param)"
endif

Then in my app somewhere in a method, I have:

if condition1
x=x=2
else
thisform.js1()
endif

What am I doing wrong?


Viewing all articles
Browse latest Browse all 10393

Trending Articles