You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Federico Fanton <ff...@ibc.it> on 2007/10/25 11:29:22 UTC

Confirmation message after form submit

Hi everyone!
I have a form with a submit button, and I need to implement a sequence like this:
- user presses the button
- form submit
- server-side validation of submitted data
- popup with confirmation message (like javascript confirm() )
- if user presses "yes", call Java method X
- if user presses "no", call Java method Y

Is this possible?
Many thanks for your time!


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Confirmation message after form submit

Posted by Eelco Hillenius <ee...@gmail.com>.
On 10/25/07, Igor Vaynberg <ig...@gmail.com> wrote:
> are you not missing istemporary() { return true; } in there...that
> would be helpful i would imagine...

You're right.

Eelco

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Confirmation message after form submit

Posted by Igor Vaynberg <ig...@gmail.com>.
are you not missing istemporary() { return true; } in there...that
would be helpful i would imagine...

-igor


On 10/25/07, Eelco Hillenius <ee...@gmail.com> wrote:
> On 10/25/07, Swaroop Belur <sw...@gmail.com> wrote:
> > Do it like this:
> >
> > In js file
> >
> > function yourconfirmationjsfunction( urltogotoonok , urltogotooncancel) {
> >
> >
> >     var retValue =  confirm(" Are you sure ");
> >     if(retValue == false){
> >      window.location.href=urltogotooncancel;
> >     }
> >
> >      window.location.href=urltogotoonok ;
> > }
>
> You can even do it completely generic, e.g. like this:
>
>         private static class AlertMessageContributor extends HeaderContributor {
>
>                 public AlertMessageContributor(final AlertMsg alertMsg) {
>                         super(new IHeaderContributor() {
>
>                                 private static final long serialVersionUID = 1L;
>
>                                 public void renderHead(IHeaderResponse response) {
>                                         response.renderOnLoadJavascript("alert('"
>                                                         + alertMsg.getMessage() + "');");
>                                 }
>                         });
>                 }
>         }
>
>
> ...
>
>         Page page = requestCycle.getResponsePage();
>         if (page != null) {
>                 page.add(new AlertMessageContributor(alertMsg));
>         }
>
>
> Eelco
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Confirmation message after form submit

Posted by Eelco Hillenius <ee...@gmail.com>.
On 10/25/07, Swaroop Belur <sw...@gmail.com> wrote:
> Do it like this:
>
> In js file
>
> function yourconfirmationjsfunction( urltogotoonok , urltogotooncancel) {
>
>
>     var retValue =  confirm(" Are you sure ");
>     if(retValue == false){
>      window.location.href=urltogotooncancel;
>     }
>
>      window.location.href=urltogotoonok ;
> }

You can even do it completely generic, e.g. like this:

	private static class AlertMessageContributor extends HeaderContributor {

		public AlertMessageContributor(final AlertMsg alertMsg) {
			super(new IHeaderContributor() {

				private static final long serialVersionUID = 1L;

				public void renderHead(IHeaderResponse response) {
					response.renderOnLoadJavascript("alert('"
							+ alertMsg.getMessage() + "');");
				}
			});
		}
	}


...

	Page page = requestCycle.getResponsePage();
	if (page != null) {
		page.add(new AlertMessageContributor(alertMsg));
	}


Eelco

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Confirmation message after form submit

Posted by Swaroop Belur <sw...@gmail.com>.
Do it like this:

In js file

function yourconfirmationjsfunction( urltogotoonok , urltogotooncancel) {


    var retValue =  confirm(" Are you sure ");
    if(retValue == false){
     window.location.href=urltogotooncancel;
    }

     window.location.href=urltogotoonok ;
}

In java file... construct these 2 urls using RequestCylce.get().urlFor
methods to ur
behaviors for example.

Then call this js function using these 2 urls

-swaroop



On 10/25/07, Federico Fanton <ff...@ibc.it> wrote:
>
> Hi everyone!
> I have a form with a submit button, and I need to implement a sequence
> like this:
> - user presses the button
> - form submit
> - server-side validation of submitted data
> - popup with confirmation message (like javascript confirm() )
> - if user presses "yes", call Java method X
> - if user presses "no", call Java method Y
>
> Is this possible?
> Many thanks for your time!
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Confirmation message after form submit

Posted by Federico Fanton <ff...@ibc.it>.
On Thu, 25 Oct 2007 11:33:57 +0100
"Dipu Seminlal" <di...@googlemail.com> wrote:

> yes  a modal window,

I see, I'll go with this solution.. Many thanks to everyone who answered :)


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Confirmation message after form submit

Posted by Dipu Seminlal <di...@googlemail.com>.
yes  a modal window,
i am not sure about how would you pop up a javascript confirm()  after doing
a server side validation.

there might be a way, but i don't know how

Dipu

On 10/25/07, Federico Fanton <ff...@ibc.it> wrote:
>
> On Thu, 25 Oct 2007 10:40:20 +0100
> "Dipu Seminlal" <di...@googlemail.com> wrote:
>
> > I think you can make use of a modal window to do this
>
> You mean, a modal window instead of the javascript confirm() ?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Confirmation message after form submit

Posted by Federico Fanton <ff...@ibc.it>.
On Thu, 25 Oct 2007 10:40:20 +0100
"Dipu Seminlal" <di...@googlemail.com> wrote:

> I think you can make use of a modal window to do this

You mean, a modal window instead of the javascript confirm() ?


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Confirmation message after form submit

Posted by Dipu Seminlal <di...@googlemail.com>.
I think you can make use of a modal window to do this

Regards
Dipu

On 10/25/07, Federico Fanton <ff...@ibc.it> wrote:
>
> Hi everyone!
> I have a form with a submit button, and I need to implement a sequence
> like this:
> - user presses the button
> - form submit
> - server-side validation of submitted data
> - popup with confirmation message (like javascript confirm() )
> - if user presses "yes", call Java method X
> - if user presses "no", call Java method Y
>
> Is this possible?
> Many thanks for your time!
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>