You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Edgar Merino <do...@gmail.com> on 2013/09/10 13:46:42 UTC

Handle form submit Exception on setDefaultModelObject

Hello, I have a Form with some components attached to it, when I submit 
the Form through an AjaxSubmitLink some of these components may throw an 
Exception while updating their models. What can I do to handle these 
Exceptions and show error messages using error() and adding the feedback 
panel to the AJaxRequestTarget, instead of showing wicket's default 
Exception page (or internal error when in production mode)?


Thanks in advance.
Edgar

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


Re: Handle form submit Exception on setDefaultModelObject

Posted by Edgar Merino <do...@gmail.com>.
Overriding Form#process(IFormSubmitter) suffices my needs, thanks for 
the quick response.


On 10/09/13 07:01, Sven Meier wrote:
> A) override Form#process(IFormSubmitter) and handle the exception
> B) implement an IRequestCycleListener which handles the exception
>
> Sven
>
> On 09/10/2013 01:46 PM, Edgar Merino wrote:
>> Hello, I have a Form with some components attached to it, when I 
>> submit the Form through an AjaxSubmitLink some of these components 
>> may throw an Exception while updating their models. What can I do to 
>> handle these Exceptions and show error messages using error() and 
>> adding the feedback panel to the AJaxRequestTarget, instead of 
>> showing wicket's default Exception page (or internal error when in 
>> production mode)?
>>
>>
>> Thanks in advance.
>> Edgar
>>
>> ---------------------------------------------------------------------
>> 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
>


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


Re: Cancel Button Conundrum

Posted by Sven Meier <sv...@meiers.net>.
You can show a ModalDialog via Ajax or use a JavaScript-only solution.

Sven

On 09/10/2013 02:58 PM, Richard W. Adams wrote:
> I need to create a Cancel button that warns the user about saved data on a
> form before leaving the page. Thus, I can't call setDefaultFormProcessing
> (false), since that would cause the data not be transferred to the model.
> But I ALSO don't want the page to complain about missing or invalid
> fields.
>
> What's the best way to accomplish these goals?
>
>
> **
>
> This email and any attachments may contain information that is confidential and/or privileged for the sole use of the intended recipient.  Any use, review, disclosure, copying, distribution or reliance by others, and any forwarding of this email or its contents, without the express permission of the sender is strictly prohibited by law.  If you are not the intended recipient, please contact the sender immediately, delete the e-mail and destroy all copies.
> **
>


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


RE: Cancel Button Conundrum

Posted by Paul Bors <pa...@bors.ws>.
You add two different submit buttons in the HTML and label them different.
Then for each one you run the different save business logic inside their own
onSubmit() methods.

There is nothing preventing you from submitting a form from different submit
buttons.

~ Thank you,
  Paul Bors

-----Original Message-----
From: Richard W. Adams [mailto:RWADAMS1@UP.COM] 
Sent: Tuesday, September 10, 2013 8:59 AM
To: users@wicket.apache.org
Subject: Cancel Button Conundrum

I need to create a Cancel button that warns the user about saved data on a
form before leaving the page. Thus, I can't call setDefaultFormProcessing
(false), since that would cause the data not be transferred to the model. 
But I ALSO don't want the page to complain about missing or invalid fields.

What's the best way to accomplish these goals?


**

This email and any attachments may contain information that is confidential
and/or privileged for the sole use of the intended recipient.  Any use,
review, disclosure, copying, distribution or reliance by others, and any
forwarding of this email or its contents, without the express permission of
the sender is strictly prohibited by law.  If you are not the intended
recipient, please contact the sender immediately, delete the e-mail and
destroy all copies.
**


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


Cancel Button Conundrum

Posted by "Richard W. Adams" <RW...@UP.COM>.
I need to create a Cancel button that warns the user about saved data on a 
form before leaving the page. Thus, I can't call setDefaultFormProcessing
(false), since that would cause the data not be transferred to the model. 
But I ALSO don't want the page to complain about missing or invalid 
fields.

What's the best way to accomplish these goals?


**

This email and any attachments may contain information that is confidential and/or privileged for the sole use of the intended recipient.  Any use, review, disclosure, copying, distribution or reliance by others, and any forwarding of this email or its contents, without the express permission of the sender is strictly prohibited by law.  If you are not the intended recipient, please contact the sender immediately, delete the e-mail and destroy all copies.
**

Re: Handle form submit Exception on setDefaultModelObject

Posted by Sven Meier <sv...@meiers.net>.
A) override Form#process(IFormSubmitter) and handle the exception
B) implement an IRequestCycleListener which handles the exception

Sven

On 09/10/2013 01:46 PM, Edgar Merino wrote:
> Hello, I have a Form with some components attached to it, when I 
> submit the Form through an AjaxSubmitLink some of these components may 
> throw an Exception while updating their models. What can I do to 
> handle these Exceptions and show error messages using error() and 
> adding the feedback panel to the AJaxRequestTarget, instead of showing 
> wicket's default Exception page (or internal error when in production 
> mode)?
>
>
> Thanks in advance.
> Edgar
>
> ---------------------------------------------------------------------
> 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