You could use an AjaxFallbackButton on your form, eg:

                AjaxFallbackButton a = new AjaxFallbackButton("id", form)
                {
                        @Override
                        protected void onSubmit(AjaxRequestTarget target, Form 
form)
                        {
                                //normal stuff
                                
                                if(target != null)
                                {
                                        //ajax stuff
                                }
                        }
                };
                form.add(a);


which should work with and without ajax.

Richard



MYoung wrote:
> 
> I have the Ajax stuff working in my form.  I want to use the same form
> (placed on a WebPage) to handle when JS is off, I override the onSubmit()
> for when JS is off.  But this must be wrong because the
> AjaxFormSubmitBehavior no longer gets call, only the onSubmit is called.
> 
>         Form f = new Form("f", new CompoundPropertyModel(this)) {
>               @Override
>               public void onSubmit() {
>                       handleRatingChanged(null);   // good when JS if off, 
> but how to
> make the Ajax stuff work
>                                                                // when JS
> is back on?
>               }
>         };
>         f.setOutputMarkupId(true);
>         f.add(new TextField("rating", Integer.class));
>         add(f);
>   
>         //
>         // Ajax stuff, after the onSubmit is overridden in the form, this
> is no longer work!
>         //
>         f.add(new AjaxFormSubmitBehavior("onsubmit") {
>               @Override
>               protected void onSubmit(AjaxRequestTarget target) {
>                       handleRatingChanged(target);
>               }
>               @Override
>               protected void onError(AjaxRequestTarget target) {
>                       
>               }
>               @Override
>               protected IAjaxCallDecorator getAjaxCallDecorator() {
>                       return new AjaxCallDecorator() {
>                               public CharSequence decorateScript(CharSequence 
> script) {
>                                       return script + " return false;";       
>                               }
>                       };
>               }
>         });
> 
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-make-a-Form-work-both-Ajax-and-no-Ajax--tp15628207p15630129.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