You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Leszek Gawron <lg...@apache.org> on 2009/05/21 12:48:58 UTC
"conditional" form validators (nested forms issue)
Hello,
say i have a small form :
* first name - text field required
* last name - text field required
* phone no - text field required
* submit button to add new contact
everything works fine until I put the form into a wizard step. It turns
out that wizard itself is a form. So now we have :
wizard
- some refreshing view
- add contact form
* first name - text field required
* last name - text field required
* phone no - text field required
* submit button to add new contact
- wizard navigation buttons
Pressing wizard "Next" button makes addContactForm validate which raises
required text fields errors. You cannot leave the step.
Is there a way to fire form/field validators only if a specific button
has been pressed?
lg
--
Leszek Gawron
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: "conditional" form validators (nested forms issue)
Posted by mallet <ry...@gmail.com>.
Check out this: http://cwiki.apache.org/WICKET/conditional-validation.html
We frequently override the isRequired method of individual fields on a form
so that they are only required in the event that a specific button was
clicked, or a specific class of button. For instance, you could tag your
submit buttons with IRequireFields, and then just check in the isRequired
method of each formcomponent.
e.g.:
TextField txt = new TextField("txtfield", model) {
public boolean isRequired() {
return findParent(Form.class).getRootForm().findSubmittingButton()
instanceof IRequireFields;
}
}
Leszek Gawron wrote:
>
> No no .. This is exactly the opposite of what I want.
>
> I cannot setDefaultFormProcessing to false for Wizard buttons - some
> screens may need other settings.
>
> I need the nested form validators NOT to fire when pressing wizard
> navigation buttons.
>
> Juan Carlos Garcia M. wrote:
>> Set Button#setDefaultFormProcessing(false)
>>
>> Also check: http://cwiki.apache.org/WICKET/multiple-submit-buttons.html
>> multiple-submit-buttons
>>
>>
>> Leszek Gawron-2 wrote:
>>> Hello,
>>>
>>> say i have a small form :
>>>
>>> * first name - text field required
>>> * last name - text field required
>>> * phone no - text field required
>>> * submit button to add new contact
>>>
>>> everything works fine until I put the form into a wizard step. It turns
>>> out that wizard itself is a form. So now we have :
>>>
>>> wizard
>>> - some refreshing view
>>> - add contact form
>>> * first name - text field required
>>> * last name - text field required
>>> * phone no - text field required
>>> * submit button to add new contact
>>> - wizard navigation buttons
>>>
>>> Pressing wizard "Next" button makes addContactForm validate which raises
>>> required text fields errors. You cannot leave the step.
>>>
>>> Is there a way to fire form/field validators only if a specific button
>>> has been pressed?
>>> lg
>>>
>>> --
>>> Leszek Gawron
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>
>
>
> --
> Leszek Gawron http://www.mobilebox.pl/krs.html
> CTO at MobileBox Ltd.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/%22conditional%22-form-validators-%28nested-forms-issue%29-tp23651166p23673085.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: "conditional" form validators (nested forms issue)
Posted by Leszek Gawron <lg...@mobilebox.pl>.
No no .. This is exactly the opposite of what I want.
I cannot setDefaultFormProcessing to false for Wizard buttons - some
screens may need other settings.
I need the nested form validators NOT to fire when pressing wizard
navigation buttons.
Juan Carlos Garcia M. wrote:
> Set Button#setDefaultFormProcessing(false)
>
> Also check: http://cwiki.apache.org/WICKET/multiple-submit-buttons.html
> multiple-submit-buttons
>
>
> Leszek Gawron-2 wrote:
>> Hello,
>>
>> say i have a small form :
>>
>> * first name - text field required
>> * last name - text field required
>> * phone no - text field required
>> * submit button to add new contact
>>
>> everything works fine until I put the form into a wizard step. It turns
>> out that wizard itself is a form. So now we have :
>>
>> wizard
>> - some refreshing view
>> - add contact form
>> * first name - text field required
>> * last name - text field required
>> * phone no - text field required
>> * submit button to add new contact
>> - wizard navigation buttons
>>
>> Pressing wizard "Next" button makes addContactForm validate which raises
>> required text fields errors. You cannot leave the step.
>>
>> Is there a way to fire form/field validators only if a specific button
>> has been pressed?
>> lg
>>
>> --
>> Leszek Gawron
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>
--
Leszek Gawron http://www.mobilebox.pl/krs.html
CTO at MobileBox Ltd.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: "conditional" form validators (nested forms issue)
Posted by "Juan Carlos Garcia M." <jc...@gmail.com>.
Set Button#setDefaultFormProcessing(false)
Also check: http://cwiki.apache.org/WICKET/multiple-submit-buttons.html
multiple-submit-buttons
Leszek Gawron-2 wrote:
>
> Hello,
>
> say i have a small form :
>
> * first name - text field required
> * last name - text field required
> * phone no - text field required
> * submit button to add new contact
>
> everything works fine until I put the form into a wizard step. It turns
> out that wizard itself is a form. So now we have :
>
> wizard
> - some refreshing view
> - add contact form
> * first name - text field required
> * last name - text field required
> * phone no - text field required
> * submit button to add new contact
> - wizard navigation buttons
>
> Pressing wizard "Next" button makes addContactForm validate which raises
> required text fields errors. You cannot leave the step.
>
> Is there a way to fire form/field validators only if a specific button
> has been pressed?
> lg
>
> --
> Leszek Gawron
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/%22conditional%22-form-validators-%28nested-forms-issue%29-tp23651166p23658102.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org