You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by David Chang <da...@yahoo.com> on 2010/06/26 04:32:04 UTC

How to Ajax-validate CheckBoxMultipleChoice?

Hi, I am unable to addres this need and have to ask the group.

I am using the ajax approach to validate each field on a form. See the following:

<div wicket:id="fullNameBorder">
<input type="text" wicket:id="fullName" />
</div>

If the above field gets focus and loses the focus without any value in it, there will be a red box around the input field. If it gets a value and loses its mouse focus, the red box disappears. All this happens without the user submitting the form.

The backend code is similar to the following:

...
inputComponent.add(new AjaxFormComponentUpdatingBehavior("onblur") {

@Override
protected void onUpdate(AjaxRequestTarget target) {
if (target != null) {
//add border and feedback panel here
}
}

@Override
protected void onError(AjaxRequestTarget target, RuntimeException e) {
if (target != null) {
//add border and feedback panel here
}
}); 
....

This approach works well for TextFields. 

Now I have a list of check boxes (implemented via CheckBoxMultipleChoice). At least one of them must be checked. The above Ajax approach is NOT working.

Can anybody there help me out on this?

All the best.


      

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How to Ajax-validate CheckBoxMultipleChoice?

Posted by David Chang <da...@yahoo.com>.
Yes. When I click Save button, wickets reports "required" error message for the CheckBoxMultipleChoice component. Thanks for chiming in!

Best.

--- On Sat, 6/26/10, yaniv kessler <ya...@gmail.com> wrote:

> From: yaniv kessler <ya...@gmail.com>
> Subject: Re: How to Ajax-validate CheckBoxMultipleChoice?
> To: users@wicket.apache.org
> Cc: wicket@indeterminate.org
> Date: Saturday, June 26, 2010, 8:47 AM
> Is that element placed / added to a
> form ?
> 
> On Sat, Jun 26, 2010 at 5:32 AM, David Chang <da...@yahoo.com>wrote:
> 
> > Hi, I am unable to addres this need and have to ask
> the group.
> >
> > I am using the ajax approach to validate each field on
> a form. See the
> > following:
> >
> > <div wicket:id="fullNameBorder">
> > <input type="text" wicket:id="fullName" />
> > </div>
> >
> > If the above field gets focus and loses the focus
> without any value in it,
> > there will be a red box around the input field. If it
> gets a value and loses
> > its mouse focus, the red box disappears. All this
> happens without the user
> > submitting the form.
> >
> > The backend code is similar to the following:
> >
> > ...
> > inputComponent.add(new
> AjaxFormComponentUpdatingBehavior("onblur") {
> >
> > @Override
> > protected void onUpdate(AjaxRequestTarget target) {
> > if (target != null) {
> > //add border and feedback panel here
> > }
> > }
> >
> > @Override
> > protected void onError(AjaxRequestTarget target,
> RuntimeException e) {
> > if (target != null) {
> > //add border and feedback panel here
> > }
> > });
> > ....
> >
> > This approach works well for TextFields.
> >
> > Now I have a list of check boxes (implemented via
> CheckBoxMultipleChoice).
> > At least one of them must be checked. The above Ajax
> approach is NOT
> > working.
> >
> > Can anybody there help me out on this?
> >
> > All the best.
> >
> >
> >
> >
> >
> ---------------------------------------------------------------------
> > 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: How to Ajax-validate CheckBoxMultipleChoice?

Posted by yaniv kessler <ya...@gmail.com>.
Is that element placed / added to a form ?

On Sat, Jun 26, 2010 at 5:32 AM, David Chang <da...@yahoo.com>wrote:

> Hi, I am unable to addres this need and have to ask the group.
>
> I am using the ajax approach to validate each field on a form. See the
> following:
>
> <div wicket:id="fullNameBorder">
> <input type="text" wicket:id="fullName" />
> </div>
>
> If the above field gets focus and loses the focus without any value in it,
> there will be a red box around the input field. If it gets a value and loses
> its mouse focus, the red box disappears. All this happens without the user
> submitting the form.
>
> The backend code is similar to the following:
>
> ...
> inputComponent.add(new AjaxFormComponentUpdatingBehavior("onblur") {
>
> @Override
> protected void onUpdate(AjaxRequestTarget target) {
> if (target != null) {
> //add border and feedback panel here
> }
> }
>
> @Override
> protected void onError(AjaxRequestTarget target, RuntimeException e) {
> if (target != null) {
> //add border and feedback panel here
> }
> });
> ....
>
> This approach works well for TextFields.
>
> Now I have a list of check boxes (implemented via CheckBoxMultipleChoice).
> At least one of them must be checked. The above Ajax approach is NOT
> working.
>
> Can anybody there help me out on this?
>
> All the best.
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>