You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by infiniter <in...@gmail.com> on 2011/11/04 05:52:56 UTC

setting and reading a JS variable from Wicket?

I've got simple wizard implemented as a JS slider. In some steps there is a
skip button and in the last step you can save the data. So this is actually
just a form with controls in every slide, and the data in the steps that
were skipped must not be saved when submitting the form.
What I wanna do is to set up a flag when the skip button is clicked and
check it when submitting the form. So how can I accomplish this without
using Ajax or workarounds like creating a hidden field and setting it a
value when the skip button is clicked?
So basically I want to avoid an unnecessary trips to server via Ajax or
extra fields in the form.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/setting-and-reading-a-JS-variable-from-Wicket-tp3989058p3989058.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: setting and reading a JS variable from Wicket?

Posted by anantasthana <an...@gmail.com>.
You can pass variables to wicket using 
wcall
like:
var wcall =
wicketAjaxGet('${url}'+'?&lat='+p.coords.latitude.toFixed(2)+'&lon='+p.coords.longitude.toFixed(2));

now in my wicket web page i have a AbstractDefaultAjaxBehavior which
receives this value 

i am embedding this url for the AbstractDefaultAjaxBehavior
using 

vars.put("url",geo.getCallbackUrl().toString());
add(TextTemplateHeaderContributor.forJavaScript(MasterPage.class,"setLocation.js",Model.valueOf(vars)));

where vars is a hashmap.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/setting-and-reading-a-JS-variable-from-Wicket-tp3989058p3989074.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org