The newer Wicket way is something like this:
@Override
protected void updateAjaxAttributes( AjaxRequestAttributes attributes )
{
AjaxCallListener backwardCompatibleAjaxCallListener = new
AjaxCallListener();
backwardCompatibleAjaxCallListener.onPrecondition(getPreconditionScript());
attributes.getAjaxCallListeners().add(backwardCompatibleAjaxCallListener);
}
On Mon, May 6, 2013 at 1:10 PM, Nick Pratt <[email protected]> wrote:
> Add an AjaxFormSubmitBehavior and override getPreconditionScript() (or
> override that for your AjaxButton)
>
>
> On Mon, May 6, 2013 at 11:39 AM, krishnamohank <[email protected]
> > wrote:
>
>> 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-tp4658587.html
>> Sent from the Users forum mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>