help with form submit

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

help with form submit

srinash
Hello, I am a beginner to wicket. I am currently having a form with email and password. I am able to validate the fields, now the next challenge is how I can display a text just above the form (like 'email' submission successful) after both fields do not have errors and clear the form fields.

Help will be appreciated

TIA
Reply | Threaded
Open this post in threaded view
|

Re: help with form submit

Josh Kamau
Hi ;

There are many ways of doing that. For now i will assume that you are not
using ajax. I will assume that you are using Model .

you can do this.

on your page, add a message property.

    private String message ;

//then add a label that reads and rights to the message

add(new Label("mylabel", new Model<String>(){

              public String getObject(){
                  return message ;
              }

             public void setObject(String object){
                  message = object ;
             }
}))

Then on your form submit , set the message value.

When ever page refreshes, the label will display the new value.

Hope that helps.

Josh.

On Tue, Jan 31, 2012 at 11:45 AM, srinash <[hidden email]> wrote:

> Hello, I am a beginner to wicket. I am currently having a form with email
> and
> password. I am able to validate the fields, now the next challenge is how I
> can display a text just above the form (like 'email' submission successful)
> after both fields do not have errors and clear the form fields.
>
> Help will be appreciated
>
> TIA
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/help-with-form-submit-tp4343850p4343850.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: help with form submit

srinash
Thanks for the reply. I will need to use Ajax as i would not want to refresh the page. CAn you let me know how I can do this by using a fallbackbutton, an example would be good.

thank you
Reply | Threaded
Open this post in threaded view
|

RE: help with form submit

Michal Wegrzyn
Maybe you will find this useful:

http://println.posterous.com/wicket-automatic-ajax-form-validation-marking

Best regards,
Michal Wegrzyn

> -----Original Message-----
> From: srinash [mailto:[hidden email]]
> Sent: Tuesday, January 31, 2012 10:07
> To: [hidden email]
> Subject: Re: help with form submit
>
> Thanks for the reply. I will need to use Ajax as i would not want to
> refresh
> the page. CAn you let me know how I can do this by using a
> fallbackbutton,
> an example would be good.
>
> thank you
>
> --
> View this message in context: http://apache-
> wicket.1842946.n4.nabble.com/help-with-form-submit-
> tp4343850p4343890.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: help with form submit

Josh Kamau
In reply to this post by srinash
To use ajax, just and the label in my previous example in your instance of
AjaxRequestTarget and make sure you have set OutputMarkupId to true for the
label.

Now if you want to submit the form via ajax, you can use an
AjaxSubmitLink....

Josh.

On Tue, Jan 31, 2012 at 12:07 PM, srinash <[hidden email]> wrote:

> Thanks for the reply. I will need to use Ajax as i would not want to
> refresh
> the page. CAn you let me know how I can do this by using a fallbackbutton,
> an example would be good.
>
> thank you
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/help-with-form-submit-tp4343850p4343890.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

RE: help with form submit

srinash
In reply to this post by Michal Wegrzyn
Thank you for the reply. I will take a look.