John, igor has given you a solution but i wanted to add that you do have
alternatives if absolutely required. when writing UI common components like
perhaps and Add / Remove button panel with an ajax add and ajax remove
button you 'may' feel disinclined to swap over to going for a ajaxlink....
 
if that's the case you could try the following:-
 
1) Extend wicket.markup.html.form.Form and override the protected void
validate() method.
2) Do something like super.validate() and then next have a custom
skipValidation() method that gets called to determine whether to can the
validation results or not. Note that super.validate() is called because
otherwise some of the state won't be present in ajax response...

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Igor Vaynberg
Sent: 14 June 2007 22:45
To: wicket-user@lists.sourceforge.net
Subject: Re: [Wicket-user] AjaxSubmitButton - Cancel


ah, well, thats easy

use ajaxlink instead of ajaxsubmitbutton - since you do not want to submit
anything, in onclick clear the bean the form is attached to and hide the
form.

-igor



On 6/14/07, John Carlson < [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote: 

You are right about that not making sense.  Maybe the third time will be the
charmÂ…  Here are the steps I'm dealing with.

 

1. user clicks on link that sets the input form to visible

 

2. user fills out half the form and then decides to press the cancel button
(an AjaxSubmitButton)

 

3. wicket doesn't process the cancel because not all the required fields are
filled in.

 

4. user fills out the rest of the form and then presses the cancel button
again

 

5. wicket sees all the required fields are filled and will now process the
cancel and hide the input form

 

6. the model is 'updated' to empty or null and the program goes on it's
merry way

 

I'm looking to cut out steps 3,4,5 and just hide the input form and set the
model to null.  Canceling is annoying if you have to fill in all the
required fields for it to work.

 

John

 

From: [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
[mailto:[EMAIL PROTECTED]
<mailto:%5Bmailto:[EMAIL PROTECTED]>  On Behalf
Of Igor Vaynberg
Sent: Thursday, June 14, 2007 12:47 PM 


To: wicket-user@lists.sourceforge.net
<mailto:wicket-user@lists.sourceforge.net> 
Subject: Re: [Wicket-user] AjaxSubmitButton - Cancel



 

you simply cannot do that, because it doesnt make sense

lets say you have add(new TextField("num", Integer.class)) and the user
enters "abc". if you skip the validation how do you expect to update the
model? you cannot convert abc to an integer so how do you expect it to be
pushed into the model's integer field? 

updating the model only makes sense if the validation passed

-igor

On 6/14/07, John Carlson <  <mailto:[EMAIL PROTECTED]>
[EMAIL PROTECTED]> wrote:

Yes, skip validation on cancel and still refresh the model.  That's my 
stumbling block.

John

-----Original Message-----
From: [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> 
[mailto:  <mailto:[EMAIL PROTECTED]>
[EMAIL PROTECTED] On Behalf Of Eelco
Hillenius
Sent: Thursday, June 14, 2007 9:29 AM
To: wicket-user@lists.sourceforge.net
<mailto:wicket-user@lists.sourceforge.net> 
Subject: Re: [Wicket-user] AjaxSubmitButton - Cancel 

On 6/14/07, John Carlson < [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote:
> I have a form with two ajaxbuttons, submit and cancel.  The form has a
> number of textfields that validate themselves 'onblur' using 
> ajaxformcomponentupdatingbehaviour.  What is the cleanest way to have
> the cancel button ignore the validation that the submit button is
> following?   I know regular buttons have this ability via the 
> defaultformprocessing(false) but I want to update the form on cancel.
> The best I have brainstormed would be to have the cancel button
separate
> from the form and some how or the other call update on the form from 
> outside it.  Any thoughts would be appreciated.

So you want to skip validation, but update the models regardless?

Eelco

------------------------------------------------------------------------ 
-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/ <http://sourceforge.net/powerbar/db2/> 
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net <mailto:Wicket-user@lists.sourceforge.net>

https://lists.sourceforge.net/lists/listinfo/wicket-user
<https://lists.sourceforge.net/lists/listinfo/wicket-user> 

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take 
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/ <http://sourceforge.net/powerbar/db2/> 
_______________________________________________
Wicket-user mailing list 
Wicket-user@lists.sourceforge.net <mailto:Wicket-user@lists.sourceforge.net>

https://lists.sourceforge.net/lists/listinfo/wicket-user
<https://lists.sourceforge.net/lists/listinfo/wicket-user>  

 


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now. 
http://sourceforge.net/powerbar/db2/ <http://sourceforge.net/powerbar/db2/> 
_______________________________________________
Wicket-user mailing list 
Wicket-user@lists.sourceforge.net <mailto:Wicket-user@lists.sourceforge.net>

https://lists.sourceforge.net/lists/listinfo/wicket-user
<https://lists.sourceforge.net/lists/listinfo/wicket-user> 






This e-mail (and any attachments) may contain privileged and/or confidential 
information. If you are not the intended recipient please do not disclose, 
copy, distribute, disseminate or take any action in reliance on it. If you have 
received this message in error please reply and tell us and then delete it. 
Should you wish to communicate with us by e-mail we cannot guarantee the 
security of any data outside our own computer systems. For the protection of 
Legal & General's systems and staff, incoming emails will be automatically 
scanned.

Any information contained in this message may be subject to applicable terms 
and conditions and must not be construed as giving investment advice within or 
outside the United Kingdom.

The following companies are subsidiary companies of the Legal & General Group 
Plc which are authorised and regulated by the Financial Services Authority for 
advising and arranging the products shown: Legal & General Partnership Services 
Limited (insurance and mortgages), Legal & General Insurance Limited 
(insurance), Legal & General Assurance Society Limited 
(life assurance, pensions and investments), Legal & General Unit Trust Managers 
Limited and Legal & General Portfolio Management Services Limited (investments).

They are registered in England under numbers shown.
The registered office is Temple Court, 11 Queen Victoria Street, London EC4N 
4TP.

Legal & General Partnership Services Limited: 5045000 Legal & General Assurance 
Society Limited: 166055 Legal & General (Unit Trust Managers) Limited: 1009418 
Legal & General (Portfolio Management Services) Limited: 2457525 Legal & 
General Insurance Limited: 423930

They are registered with the Financial Services Authority under numbers shown. 
You can check this at www.fsa.gov.uk/register

Legal & General Partnership Services Limited: 300792 Legal & General Assurance 
Society Limited: 117659 Legal & General (Unit Trust Managers) Limited: 119273 
Legal & General (Portfolio Management Services) Limited: 146786 Legal & General 
Insurance Limited: 202050

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to