You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Francisco Diaz Trepat - gmail <fr...@gmail.com> on 2007/09/24 20:53:05 UTC
Need combo to determine action but validation fails
Hi all,
I have a simple Form that contains a DropDownChoice. I have a submit button
and a submit link to change part of the form based on the option selected in
the DropDownChoice.
What it is happening is that because of some fields are invalid (Empty) I
cannot get to the selected option of the DropDownChoice, and by that change
part of the form.
final AjaxSubmitLink cDetailedForm = new AjaxSubmitLink("DetailedForm") {
public void onSubmit(AjaxRequestTarget target, Form form) {
showHideDetailsOnForm(target);
}
public void onError(AjaxRequestTarget target, Form form) {
showHideDetailsOnForm(target);
}
};
private void showHideDetailsOnForm(){
String option = ((Map)getModel().getObject()).get("DetailsChoices");
if(option.equals("2")){
}
.....etc.
}
As the form validation fails, I cannot get to the model. If I set
DefaultFormProcessing to false it doesn't submit it either.
Question Time:
Is there a way to set validations to buttons or submit elements in
particular?
Ex. If I click the button named "SubmitAndValidateAll" some validations are
executed and if I click the button named "SubmitButDontValidateAge" some
not...
f(t)
Re: Need combo to determine action but validation fails
Posted by Francisco Diaz Trepat - gmail <fr...@gmail.com>.
Thanks to all.
Finally I solve it by calling the getRawInput.
Thanks anyways guys.
f(t)
On 9/26/07, Kent Tong <ke...@cpttm.org.mo> wrote:
>
>
>
> Francisco Diaz Trepat - gmail wrote:
> >
> > What it is happening is that because of some fields are invalid (Empty)
> I
> > cannot get to the selected option of the DropDownChoice, and by that
> > change
> > part of the form.
> >
>
> Try:
>
> private void showHideDetailsOnForm(AjaxRequestTarget target) {
> cDetailsChoices.processInput();
> ...
> }
> --
> View this message in context:
> http://www.nabble.com/Need-combo-to-determine-action-but-validation-fails-tf4511066.html#a12893753
> 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: Need combo to determine action but validation fails
Posted by Kent Tong <ke...@cpttm.org.mo>.
Francisco Diaz Trepat - gmail wrote:
>
> What it is happening is that because of some fields are invalid (Empty) I
> cannot get to the selected option of the DropDownChoice, and by that
> change
> part of the form.
>
Try:
private void showHideDetailsOnForm(AjaxRequestTarget target) {
cDetailsChoices.processInput();
...
}
--
View this message in context: http://www.nabble.com/Need-combo-to-determine-action-but-validation-fails-tf4511066.html#a12893753
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: Need combo to determine action but validation fails
Posted by Francisco Diaz Trepat - gmail <fr...@gmail.com>.
I did. But it is the same as I don't have the form valid at the time of
change.
If I change the DropDown with an empty field the validator of the required
field will invalidate the form an hence I won't get the model.
Did I miss something?
Thanks,
f(t)
On 9/25/07, Swaroop Belur <sw...@gmail.com> wrote:
>
> Hi
>
> You should be looking at AjaxFormComponentUpdatingBehavior . Override the
> onUpdate(AjaxRequestTarget target) method. This will update your
> dropdownchoice
> model. Based on that you will be able to refresh the relevant parts
> via Ajax.
>
>
>
>
>
>
> On 9/25/07, Francisco Diaz Trepat - gmail <fr...@gmail.com>
> wrote:
> >
> > Hi all,
> >
> > I have a simple Form that contains a DropDownChoice. I have a submit
> > button
> > and a submit link to change part of the form based on the option
> selected
> > in
> > the DropDownChoice.
> >
> > What it is happening is that because of some fields are invalid (Empty)
> I
> > cannot get to the selected option of the DropDownChoice, and by that
> > change
> > part of the form.
> >
> >
> > final AjaxSubmitLink cDetailedForm = new AjaxSubmitLink("DetailedForm")
> {
> > public void onSubmit(AjaxRequestTarget target, Form form) {
> > showHideDetailsOnForm(target);
> > }
> > public void onError(AjaxRequestTarget target, Form form) {
> > showHideDetailsOnForm(target);
> > }
> > };
> >
> > private void showHideDetailsOnForm(){
> >
> > String option = ((Map)getModel().getObject()).get("DetailsChoices");
> >
> > if(option.equals("2")){
> >
> >
> >
> > }
> >
> > .....etc.
> >
> > }
> >
> > As the form validation fails, I cannot get to the model. If I set
> > DefaultFormProcessing to false it doesn't submit it either.
> >
> >
> > Question Time:
> >
> > Is there a way to set validations to buttons or submit elements in
> > particular?
> >
> > Ex. If I click the button named "SubmitAndValidateAll" some validations
> > are
> > executed and if I click the button named "SubmitButDontValidateAge" some
> > not...
> >
> >
> > f(t)
> >
>
Re: Need combo to determine action but validation fails
Posted by Swaroop Belur <sw...@gmail.com>.
Hi
You should be looking at AjaxFormComponentUpdatingBehavior . Override the
onUpdate(AjaxRequestTarget target) method. This will update your
dropdownchoice
model. Based on that you will be able to refresh the relevant parts
via Ajax.
On 9/25/07, Francisco Diaz Trepat - gmail <fr...@gmail.com>
wrote:
>
> Hi all,
>
> I have a simple Form that contains a DropDownChoice. I have a submit
> button
> and a submit link to change part of the form based on the option selected
> in
> the DropDownChoice.
>
> What it is happening is that because of some fields are invalid (Empty) I
> cannot get to the selected option of the DropDownChoice, and by that
> change
> part of the form.
>
>
> final AjaxSubmitLink cDetailedForm = new AjaxSubmitLink("DetailedForm") {
> public void onSubmit(AjaxRequestTarget target, Form form) {
> showHideDetailsOnForm(target);
> }
> public void onError(AjaxRequestTarget target, Form form) {
> showHideDetailsOnForm(target);
> }
> };
>
> private void showHideDetailsOnForm(){
>
> String option = ((Map)getModel().getObject()).get("DetailsChoices");
>
> if(option.equals("2")){
>
>
>
> }
>
> .....etc.
>
> }
>
> As the form validation fails, I cannot get to the model. If I set
> DefaultFormProcessing to false it doesn't submit it either.
>
>
> Question Time:
>
> Is there a way to set validations to buttons or submit elements in
> particular?
>
> Ex. If I click the button named "SubmitAndValidateAll" some validations
> are
> executed and if I click the button named "SubmitButDontValidateAge" some
> not...
>
>
> f(t)
>