Got a problem and don't know what I'm doin and cannot think of a way to solve
it.

I have a form within a wizard step. The 'next' button is disabled and
enabled via an ajax call when certain form data is changed. The page is
first rendered without an active 'next' button and so it is not the default.
When I press Enter, after enabling the 'next' button, something else (ie
performs 'previous' submit) or nothing happens.

Tried the following...

        serviceType.add(new AjaxFormComponentUpdatingBehavior("onchange") {
            protected void onUpdate(AjaxRequestTarget target) {
                ......
                setComplete(true); // WizardStep should now display 'next'
button

                NextButton next = (NextButton) buttonBar.get("next");
                Form form = (Form) get("form");
                form.setDefaultButton(next);
                target.addComponent(form);
                target.addComponent(next);
            }
        }

This wipes all form data (which I understand but don't know how to
circumvent easily apart from adding the  other components again which sucks)
but in some cases it weirdly allows Enter to fire the 'next' submit
sometimes if another ajax request occurs between the above event and submit.

Can anyone tell me if I'm on the right track or doing something crazy or if
there is a better way to approach it? Or should I go back to basics ;)

Cheers,
Russell
-- 
View this message in context: 
http://www.nabble.com/Changing-default-form-button-via-Ajax-tp18096567p18096567.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to