You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Vitek Tajzich <v....@gmail.com> on 2009/02/19 16:07:23 UTC
form - ajax submit and validation
Hi guys,
I have form and AjaxButton as submit button for the form. If I use non ajax
button validation is called and input fields are validated. But If I use
AjaxButton then validation are passed....What should I do to get form
validated even If I use ajax button?
thank you,
Vitek
Re: form - ajax submit and validation
Posted by Vitek Tajzich <v....@gmail.com>.
Yes, that is right...I'm....it is obvious :-)
thank you all for your help!
V.
2009/2/20 Martin Voigt <ma...@artnology.com>
> You can set the form processing mode per button:
>
> submitButton.setDefaultFormProcessing(true);
> cancelButton.setDefaultFormProcessing(false);
>
> So if the user clicks submitButton, the form is validated, if she
> clicks cancelButton, it is not.
>
> Martin
>
>
>
> 2009/2/20 Vitek Tajzich <v....@gmail.com>:
> > Well....sometimes is a good idea to read a documentation :-)
> >
> > I found on wicket's wiki that I have to update feedback panel. This
> should
> > be done like this:
> >
> > protected void onError(final AjaxRequestTarget target, final Form form) {
> > // or update the feedback panel
> > target.addComponent(form.getPage().get("feedback"));
> > }
> >
> >
> > And It is work! :-)
> >
> > So, If you have only one submit button, do not set defaultFormProcessing
> =
> > false, because this will remove validation and do not forget to update
> > feedbackpanel like in an example above.
> >
> > One more question remains. What If I have more than one submit buttons
> and I
> > have to set defaultFormProcessing = false. How can I call validation?
> >
> > thx,
> >
> > V.
> >
> > 2009/2/20 Vitek Tajzich <v....@gmail.com>
> >
> >> well it happend inside of Form....I cannot do anything....
> >>
> >> 2009/2/20 Martijn Dashorst <ma...@gmail.com>
> >>
> >> perhaps add the feedback panel to the ajax request target?
> >>>
> >>> Martijn
> >>>
> >>> On Fri, Feb 20, 2009 at 10:55 AM, Vitek Tajzich <v....@gmail.com>
> >>> wrote:
> >>> > Hi,
> >>> >
> >>> > that was my mistake. I set to submit button defaultFormProcessing =
> >>> false
> >>> > and that is why validation haven't been processed.
> >>> >
> >>> > Now validations are processed but I'm getting this warning:
> >>> > Component-targetted feedback message was left unrendered. This could
> be
> >>> > because you are missing a FeedbackPanel on the page.
> >>> >
> >>> > And no validation message is displayed.
> >>> >
> >>> > But when I use non ajax based submit then message are shown
> correctly.
> >>> >
> >>> > piece of code...
> >>> >
> >>> > IndicatingAjaxButton orderSubmit = new
> >>> IndicatingAjaxButton("order-submit",
> >>> > orderForm) {
> >>> >
> >>> > private static final long serialVersionUID =
> >>> > -3779837727856697099L;
> >>> >
> >>> > /** {@inheritDoc} */
> >>> > @Override
> >>> > protected void onSubmit(AjaxRequestTarget target, Form<?>
> >>> form)
> >>> > {
> >>> >
> >>> > //some bussines logic here
> >>> > }
> >>> > };
> >>> >
> >>> >
> >>> >
> >>> > 2009/2/19 Matt Welch <ma...@welchkin.net>
> >>> >
> >>> >>
> >>> >> I think more information is needed before someone can provide a
> useful
> >>> >> response:
> >>> >>
> >>> >>
> >>> >> Are you initializing the AjaxButton with the form (in the the
> >>> constructor
> >>> >> of
> >>> >> the AjaxButton or with setter)?
> >>> >> Is the form data being submitted? If not, this would indicate a
> problem
> >>> >> somewhere other than in the validation itself.
> >>> >> Can you show your actual code?
> >>> >>
> >>> >>
> >>> >>
> >>> >>
> >>> >> Vitek.Tajzich wrote:
> >>> >> >
> >>> >> > Hi guys,
> >>> >> >
> >>> >> > I have form and AjaxButton as submit button for the form. If I use
> >>> non
> >>> >> > ajax
> >>> >> > button validation is called and input fields are validated. But If
> I
> >>> use
> >>> >> > AjaxButton then validation are passed....What should I do to get
> form
> >>> >> > validated even If I use ajax button?
> >>> >> >
> >>> >> > thank you,
> >>> >> >
> >>> >> > Vitek
> >>> >> >
> >>> >> >
> >>> >>
> >>> >> --
> >>> >> View this message in context:
> >>> >>
> >>>
> http://www.nabble.com/form---ajax-submit-and-validation-tp22102523p22104799.html
> >>> >> Sent from the Wicket - User mailing list archive at Nabble.com.
> >>> >>
> >>> >
> >>>
> >>>
> >>>
> >>> --
> >>> Become a Wicket expert, learn from the best: http://wicketinaction.com
> >>> Apache Wicket 1.3.5 is released
> >>> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
> >>>
> >>> ---------------------------------------------------------------------
> >>> 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: form - ajax submit and validation
Posted by Martin Voigt <ma...@artnology.com>.
You can set the form processing mode per button:
submitButton.setDefaultFormProcessing(true);
cancelButton.setDefaultFormProcessing(false);
So if the user clicks submitButton, the form is validated, if she
clicks cancelButton, it is not.
Martin
2009/2/20 Vitek Tajzich <v....@gmail.com>:
> Well....sometimes is a good idea to read a documentation :-)
>
> I found on wicket's wiki that I have to update feedback panel. This should
> be done like this:
>
> protected void onError(final AjaxRequestTarget target, final Form form) {
> // or update the feedback panel
> target.addComponent(form.getPage().get("feedback"));
> }
>
>
> And It is work! :-)
>
> So, If you have only one submit button, do not set defaultFormProcessing =
> false, because this will remove validation and do not forget to update
> feedbackpanel like in an example above.
>
> One more question remains. What If I have more than one submit buttons and I
> have to set defaultFormProcessing = false. How can I call validation?
>
> thx,
>
> V.
>
> 2009/2/20 Vitek Tajzich <v....@gmail.com>
>
>> well it happend inside of Form....I cannot do anything....
>>
>> 2009/2/20 Martijn Dashorst <ma...@gmail.com>
>>
>> perhaps add the feedback panel to the ajax request target?
>>>
>>> Martijn
>>>
>>> On Fri, Feb 20, 2009 at 10:55 AM, Vitek Tajzich <v....@gmail.com>
>>> wrote:
>>> > Hi,
>>> >
>>> > that was my mistake. I set to submit button defaultFormProcessing =
>>> false
>>> > and that is why validation haven't been processed.
>>> >
>>> > Now validations are processed but I'm getting this warning:
>>> > Component-targetted feedback message was left unrendered. This could be
>>> > because you are missing a FeedbackPanel on the page.
>>> >
>>> > And no validation message is displayed.
>>> >
>>> > But when I use non ajax based submit then message are shown correctly.
>>> >
>>> > piece of code...
>>> >
>>> > IndicatingAjaxButton orderSubmit = new
>>> IndicatingAjaxButton("order-submit",
>>> > orderForm) {
>>> >
>>> > private static final long serialVersionUID =
>>> > -3779837727856697099L;
>>> >
>>> > /** {@inheritDoc} */
>>> > @Override
>>> > protected void onSubmit(AjaxRequestTarget target, Form<?>
>>> form)
>>> > {
>>> >
>>> > //some bussines logic here
>>> > }
>>> > };
>>> >
>>> >
>>> >
>>> > 2009/2/19 Matt Welch <ma...@welchkin.net>
>>> >
>>> >>
>>> >> I think more information is needed before someone can provide a useful
>>> >> response:
>>> >>
>>> >>
>>> >> Are you initializing the AjaxButton with the form (in the the
>>> constructor
>>> >> of
>>> >> the AjaxButton or with setter)?
>>> >> Is the form data being submitted? If not, this would indicate a problem
>>> >> somewhere other than in the validation itself.
>>> >> Can you show your actual code?
>>> >>
>>> >>
>>> >>
>>> >>
>>> >> Vitek.Tajzich wrote:
>>> >> >
>>> >> > Hi guys,
>>> >> >
>>> >> > I have form and AjaxButton as submit button for the form. If I use
>>> non
>>> >> > ajax
>>> >> > button validation is called and input fields are validated. But If I
>>> use
>>> >> > AjaxButton then validation are passed....What should I do to get form
>>> >> > validated even If I use ajax button?
>>> >> >
>>> >> > thank you,
>>> >> >
>>> >> > Vitek
>>> >> >
>>> >> >
>>> >>
>>> >> --
>>> >> View this message in context:
>>> >>
>>> http://www.nabble.com/form---ajax-submit-and-validation-tp22102523p22104799.html
>>> >> Sent from the Wicket - User mailing list archive at Nabble.com.
>>> >>
>>> >
>>>
>>>
>>>
>>> --
>>> Become a Wicket expert, learn from the best: http://wicketinaction.com
>>> Apache Wicket 1.3.5 is released
>>> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
>>>
>>> ---------------------------------------------------------------------
>>> 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: form - ajax submit and validation
Posted by Vitek Tajzich <v....@gmail.com>.
Well....sometimes is a good idea to read a documentation :-)
I found on wicket's wiki that I have to update feedback panel. This should
be done like this:
protected void onError(final AjaxRequestTarget target, final Form form) {
// or update the feedback panel
target.addComponent(form.getPage().get("feedback"));
}
And It is work! :-)
So, If you have only one submit button, do not set defaultFormProcessing =
false, because this will remove validation and do not forget to update
feedbackpanel like in an example above.
One more question remains. What If I have more than one submit buttons and I
have to set defaultFormProcessing = false. How can I call validation?
thx,
V.
2009/2/20 Vitek Tajzich <v....@gmail.com>
> well it happend inside of Form....I cannot do anything....
>
> 2009/2/20 Martijn Dashorst <ma...@gmail.com>
>
> perhaps add the feedback panel to the ajax request target?
>>
>> Martijn
>>
>> On Fri, Feb 20, 2009 at 10:55 AM, Vitek Tajzich <v....@gmail.com>
>> wrote:
>> > Hi,
>> >
>> > that was my mistake. I set to submit button defaultFormProcessing =
>> false
>> > and that is why validation haven't been processed.
>> >
>> > Now validations are processed but I'm getting this warning:
>> > Component-targetted feedback message was left unrendered. This could be
>> > because you are missing a FeedbackPanel on the page.
>> >
>> > And no validation message is displayed.
>> >
>> > But when I use non ajax based submit then message are shown correctly.
>> >
>> > piece of code...
>> >
>> > IndicatingAjaxButton orderSubmit = new
>> IndicatingAjaxButton("order-submit",
>> > orderForm) {
>> >
>> > private static final long serialVersionUID =
>> > -3779837727856697099L;
>> >
>> > /** {@inheritDoc} */
>> > @Override
>> > protected void onSubmit(AjaxRequestTarget target, Form<?>
>> form)
>> > {
>> >
>> > //some bussines logic here
>> > }
>> > };
>> >
>> >
>> >
>> > 2009/2/19 Matt Welch <ma...@welchkin.net>
>> >
>> >>
>> >> I think more information is needed before someone can provide a useful
>> >> response:
>> >>
>> >>
>> >> Are you initializing the AjaxButton with the form (in the the
>> constructor
>> >> of
>> >> the AjaxButton or with setter)?
>> >> Is the form data being submitted? If not, this would indicate a problem
>> >> somewhere other than in the validation itself.
>> >> Can you show your actual code?
>> >>
>> >>
>> >>
>> >>
>> >> Vitek.Tajzich wrote:
>> >> >
>> >> > Hi guys,
>> >> >
>> >> > I have form and AjaxButton as submit button for the form. If I use
>> non
>> >> > ajax
>> >> > button validation is called and input fields are validated. But If I
>> use
>> >> > AjaxButton then validation are passed....What should I do to get form
>> >> > validated even If I use ajax button?
>> >> >
>> >> > thank you,
>> >> >
>> >> > Vitek
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/form---ajax-submit-and-validation-tp22102523p22104799.html
>> >> Sent from the Wicket - User mailing list archive at Nabble.com.
>> >>
>> >
>>
>>
>>
>> --
>> Become a Wicket expert, learn from the best: http://wicketinaction.com
>> Apache Wicket 1.3.5 is released
>> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
Re: form - ajax submit and validation
Posted by Vitek Tajzich <v....@gmail.com>.
well it happend inside of Form....I cannot do anything....
2009/2/20 Martijn Dashorst <ma...@gmail.com>
> perhaps add the feedback panel to the ajax request target?
>
> Martijn
>
> On Fri, Feb 20, 2009 at 10:55 AM, Vitek Tajzich <v....@gmail.com>
> wrote:
> > Hi,
> >
> > that was my mistake. I set to submit button defaultFormProcessing = false
> > and that is why validation haven't been processed.
> >
> > Now validations are processed but I'm getting this warning:
> > Component-targetted feedback message was left unrendered. This could be
> > because you are missing a FeedbackPanel on the page.
> >
> > And no validation message is displayed.
> >
> > But when I use non ajax based submit then message are shown correctly.
> >
> > piece of code...
> >
> > IndicatingAjaxButton orderSubmit = new
> IndicatingAjaxButton("order-submit",
> > orderForm) {
> >
> > private static final long serialVersionUID =
> > -3779837727856697099L;
> >
> > /** {@inheritDoc} */
> > @Override
> > protected void onSubmit(AjaxRequestTarget target, Form<?>
> form)
> > {
> >
> > //some bussines logic here
> > }
> > };
> >
> >
> >
> > 2009/2/19 Matt Welch <ma...@welchkin.net>
> >
> >>
> >> I think more information is needed before someone can provide a useful
> >> response:
> >>
> >>
> >> Are you initializing the AjaxButton with the form (in the the
> constructor
> >> of
> >> the AjaxButton or with setter)?
> >> Is the form data being submitted? If not, this would indicate a problem
> >> somewhere other than in the validation itself.
> >> Can you show your actual code?
> >>
> >>
> >>
> >>
> >> Vitek.Tajzich wrote:
> >> >
> >> > Hi guys,
> >> >
> >> > I have form and AjaxButton as submit button for the form. If I use non
> >> > ajax
> >> > button validation is called and input fields are validated. But If I
> use
> >> > AjaxButton then validation are passed....What should I do to get form
> >> > validated even If I use ajax button?
> >> >
> >> > thank you,
> >> >
> >> > Vitek
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/form---ajax-submit-and-validation-tp22102523p22104799.html
> >> Sent from the Wicket - User mailing list archive at Nabble.com.
> >>
> >
>
>
>
> --
> Become a Wicket expert, learn from the best: http://wicketinaction.com
> Apache Wicket 1.3.5 is released
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: form - ajax submit and validation
Posted by Martijn Dashorst <ma...@gmail.com>.
perhaps add the feedback panel to the ajax request target?
Martijn
On Fri, Feb 20, 2009 at 10:55 AM, Vitek Tajzich <v....@gmail.com> wrote:
> Hi,
>
> that was my mistake. I set to submit button defaultFormProcessing = false
> and that is why validation haven't been processed.
>
> Now validations are processed but I'm getting this warning:
> Component-targetted feedback message was left unrendered. This could be
> because you are missing a FeedbackPanel on the page.
>
> And no validation message is displayed.
>
> But when I use non ajax based submit then message are shown correctly.
>
> piece of code...
>
> IndicatingAjaxButton orderSubmit = new IndicatingAjaxButton("order-submit",
> orderForm) {
>
> private static final long serialVersionUID =
> -3779837727856697099L;
>
> /** {@inheritDoc} */
> @Override
> protected void onSubmit(AjaxRequestTarget target, Form<?> form)
> {
>
> //some bussines logic here
> }
> };
>
>
>
> 2009/2/19 Matt Welch <ma...@welchkin.net>
>
>>
>> I think more information is needed before someone can provide a useful
>> response:
>>
>>
>> Are you initializing the AjaxButton with the form (in the the constructor
>> of
>> the AjaxButton or with setter)?
>> Is the form data being submitted? If not, this would indicate a problem
>> somewhere other than in the validation itself.
>> Can you show your actual code?
>>
>>
>>
>>
>> Vitek.Tajzich wrote:
>> >
>> > Hi guys,
>> >
>> > I have form and AjaxButton as submit button for the form. If I use non
>> > ajax
>> > button validation is called and input fields are validated. But If I use
>> > AjaxButton then validation are passed....What should I do to get form
>> > validated even If I use ajax button?
>> >
>> > thank you,
>> >
>> > Vitek
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/form---ajax-submit-and-validation-tp22102523p22104799.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>
--
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.5 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: form - ajax submit and validation
Posted by Vitek Tajzich <v....@gmail.com>.
Hi,
that was my mistake. I set to submit button defaultFormProcessing = false
and that is why validation haven't been processed.
Now validations are processed but I'm getting this warning:
Component-targetted feedback message was left unrendered. This could be
because you are missing a FeedbackPanel on the page.
And no validation message is displayed.
But when I use non ajax based submit then message are shown correctly.
piece of code...
IndicatingAjaxButton orderSubmit = new IndicatingAjaxButton("order-submit",
orderForm) {
private static final long serialVersionUID =
-3779837727856697099L;
/** {@inheritDoc} */
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form)
{
//some bussines logic here
}
};
2009/2/19 Matt Welch <ma...@welchkin.net>
>
> I think more information is needed before someone can provide a useful
> response:
>
>
> Are you initializing the AjaxButton with the form (in the the constructor
> of
> the AjaxButton or with setter)?
> Is the form data being submitted? If not, this would indicate a problem
> somewhere other than in the validation itself.
> Can you show your actual code?
>
>
>
>
> Vitek.Tajzich wrote:
> >
> > Hi guys,
> >
> > I have form and AjaxButton as submit button for the form. If I use non
> > ajax
> > button validation is called and input fields are validated. But If I use
> > AjaxButton then validation are passed....What should I do to get form
> > validated even If I use ajax button?
> >
> > thank you,
> >
> > Vitek
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/form---ajax-submit-and-validation-tp22102523p22104799.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
Re: form - ajax submit and validation
Posted by Matt Welch <ma...@welchkin.net>.
I think more information is needed before someone can provide a useful
response:
Are you initializing the AjaxButton with the form (in the the constructor of
the AjaxButton or with setter)?
Vitek.Tajzich wrote:
>
> Hi guys,
>
> I have form and AjaxButton as submit button for the form. If I use non
> ajax
> button validation is called and input fields are validated. But If I use
> AjaxButton then validation are passed....What should I do to get form
> validated even If I use ajax button?
>
> thank you,
>
> Vitek
>
>
--
View this message in context: http://www.nabble.com/form---ajax-submit-and-validation-tp22102523p22104799.html
Sent from the Wicket - User mailing list archive at Nabble.com.