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 = $('<<cawID(m.thisForm)>>'); 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([$('<<cawID(m.thisForm)>>').property = <<cLitteralJS(<some VFP value>)>>;])) 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?
-- thn (FoxInCloud)