You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by krishnamohank <k....@gmail.com> on 2013/05/06 17:13:13 UTC

Adding javascript to form submit

I have a wicket Form and a AjaxButton on it, my requirement is to create a
cookie/local storage on form submit. For this i tried to add following js:

addEvent(form[0], "submit", save);

function addEvent(elem, evt, fn) {
		if (elem.addEventListener) 
			elem.addEventListener(evt, fn, false); 
		else if (elem.attachEvent) 
			elem.attachEvent("on" + evt, fn); 
}

function save() {
........
createStorage(....);
}

but this js is not executed at all, submit event is not fired.(I dont want
to use setPersistent() also as I want to use localstorage as well)

Can you please tell me how to add  javascript to form submit for the above
scenario.

TIA
Krishna Mohan






--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Adding-javascript-to-form-submit-tp4658586.html
Sent from the Forum for Wicket Core developers mailing list archive at Nabble.com.

Re: Adding javascript to form submit

Posted by Andrea Del Bene <an...@gmail.com>.
Please, send this kind of mail to the user mailing list 
(users@wicket.apache.org).
> I have a wicket Form and a AjaxButton on it, my requirement is to create a
> cookie/local storage on form submit. For this i tried to add following js:
>
> addEvent(form[0], "submit", save);
>
> function addEvent(elem, evt, fn) {
> 		if (elem.addEventListener)
> 			elem.addEventListener(evt, fn, false);
> 		else if (elem.attachEvent)
> 			elem.attachEvent("on" + evt, fn);
> }
>
> function save() {
> ........
> createStorage(....);
> }
>
> but this js is not executed at all, submit event is not fired.(I dont want
> to use setPersistent() also as I want to use localstorage as well)
>
> Can you please tell me how to add  javascript to form submit for the above
> scenario.
>
> TIA
> Krishna Mohan
>
>
>
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Adding-javascript-to-form-submit-tp4658586.html
> Sent from the Forum for Wicket Core developers mailing list archive at Nabble.com.