Re: [Wicket-user] Disabling Validation, but keeping updateFormComponentModels()

2007-07-17 Thread Fisher, Brice A
An additional question.  Trying to do things the brute force way, I
implemented the following in my form:
 
 
@Override
protected void validate() {
Button b = findSubmittingButton();
if (b == updateButton) {
super.validate();

// Additional validations...
} else {
updateFormComponentModels();
}
}

 
If the else branch is taken, then the fields from the form are null.
If I switch my RequiredTextFields to TextFields and force the if
branch, then the form fields are correctly populated.  So, apparently
there is more happening in super.validate() than is covered by
updateFormComponentModels().

However, if I look at super.validate(), it includes:

validateRequired();
validateConversion();
validateValidators();
validateFormValidators();

None of which are available in the inherited class.

So, should I plan on re-implementing the contents of one or more of
these functions in my class or is there another method I can call to
correctly populate the form elements?

Thanks,
- Brice




From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Fisher,
Brice A
Sent: Monday, July 16, 2007 3:50 PM
To: wicket-user@lists.sourceforge.net
Subject: [Wicket-user] Disabling Validation, but keeping
updateFormComponentModels()



Using Wicket 1.2.6. 

I have a screen with wizard like functionality.  Specifically, the
screen is used to edit an object.  The object includes collections of
sub-objects which I jump to sub-screens to populate and then return to
the main display screen.  So I have fields (some required, some not),
several buttons to launch one of the sub-object screens, and a button to
save the overall object hierarchy.

If I execute without validation (i.e. no Required fields and no custom
validation), everything works fine.  If I switch to Required fields and
write some custom validation, I can't launch the sub-object edit screens
because validation fails on some fields.  If I switch the buttons on the
sub-object screens to setDefaultFormProcessing(false) then any data
from the original screen is lost because the model doesn't get updated.

My hierarchy is something like Page - Panel - Input Form - Panel -
Button, so from the Button's onSubmit(), I can call getForm().process(),
but I can't call getForm().updateFormComponentModels() because it's not
visible.

So, I need to be able to tell Wicket to update the model without
applying the validations for one set of buttons and to update the model
and run the validations with another set of buttons.  Is there a way of
doing this without rewriting the Form.validation() logic using a check
to see what button was pressed?

I found this discussion
(http://www.mail-archive.com/wicket-user@lists.sourceforge.net/msg17973.
html
http://www.mail-archive.com/wicket-user@lists.sourceforge.net/msg17973.
html ), but it doesn't seem to answer the question.

Thanks, 
- Brice 



-
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


Re: [Wicket-user] Disabling Validation, but keeping updateFormComponentModels()

2007-07-17 Thread Igor Vaynberg
On 7/17/07, Fisher, Brice A [EMAIL PROTECTED] wrote:

 An additional question.  Trying to do things the brute force way, I
 implemented the following in my form:


 @Override
 protected void validate() {
 Button b = findSubmittingButton();
 if (b == updateButton) {
 super.validate();

 // Additional validations...
 } else {
 updateFormComponentModels();
 }
 }


 If the else branch is taken, then the fields from the form are null.
 If I switch my RequiredTextFields to TextFields and force the if
 branch, then the form fields are correctly populated.  So, apparently
 there is more happening in super.validate() than is covered by
 updateFormComponentModels().

 However, if I look at super.validate(), it includes:

 validateRequired();
 validateConversion();
 validateValidators();
 validateFormValidators();

 None of which are available in the inherited class.

 So, should I plan on re-implementing the contents of one or more of
 these functions in my class or is there another method I can call to
 correctly populate the form elements?


you cannot update models without validation. a simple example:
you have TextField(number, Integer.class); and the user enters a.
obviously you cannot put a into a model that expects an Integer.

-igor
-
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