You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Warren Bell <wa...@clarksnutrition.com> on 2010/08/19 07:01:54 UTC

dynamically adding validators to TextFields in a ListView

I have a ListView that adds one TextField to each ListItem. These
TextFields need to have different types of validators added to them
depending on a condition. One TextField in the first ListItem may need
an email validator while the TextField in the next ListItem may need a
number range validator and so on.
 
What is the best way to do this type of validation?
 
Warren
 

Re: dynamically adding validators to TextFields in a ListView

Posted by Igor Vaynberg <ig...@gmail.com>.
setreuseitems(true) on the listview, its in the javadoc

-igor

On Thu, Aug 19, 2010 at 8:17 AM, Warren Bell
<wa...@clarksnutrition.com> wrote:
> I have that working ok, but I am trying to add an atribute to the
> TextField when it is invalid. The problem is that a new TextField is
> created when the page is rerendered. I have a workaround, but it is
> ugly. Any sugestions?
>
> -----Original Message-----
> From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
> Sent: Wednesday, August 18, 2010 10:40 PM
> To: users@wicket.apache.org
> Subject: Re: dynamically adding validators to TextFields in a ListView
>
> whatever is creating the textfield should add the appropriate validator
>
> -igor
>
> On Wed, Aug 18, 2010 at 10:01 PM, Warren Bell
> <wa...@clarksnutrition.com> wrote:
>> I have a ListView that adds one TextField to each ListItem. These
>> TextFields need to have different types of validators added to them
>> depending on a condition. One TextField in the first ListItem may need
>
>> an email validator while the TextField in the next ListItem may need a
>
>> number range validator and so on.
>>
>> What is the best way to do this type of validation?
>>
>> Warren
>>
>>
>
> ---------------------------------------------------------------------
> 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
>
>

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


RE: dynamically adding validators to TextFields in a ListView

Posted by Warren Bell <wa...@clarksnutrition.com>.
I have that working ok, but I am trying to add an atribute to the
TextField when it is invalid. The problem is that a new TextField is
created when the page is rerendered. I have a workaround, but it is
ugly. Any sugestions?

-----Original Message-----
From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com] 
Sent: Wednesday, August 18, 2010 10:40 PM
To: users@wicket.apache.org
Subject: Re: dynamically adding validators to TextFields in a ListView

whatever is creating the textfield should add the appropriate validator

-igor

On Wed, Aug 18, 2010 at 10:01 PM, Warren Bell
<wa...@clarksnutrition.com> wrote:
> I have a ListView that adds one TextField to each ListItem. These 
> TextFields need to have different types of validators added to them 
> depending on a condition. One TextField in the first ListItem may need

> an email validator while the TextField in the next ListItem may need a

> number range validator and so on.
>
> What is the best way to do this type of validation?
>
> Warren
>
>

---------------------------------------------------------------------
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: dynamically adding validators to TextFields in a ListView

Posted by Igor Vaynberg <ig...@gmail.com>.
whatever is creating the textfield should add the appropriate validator

-igor

On Wed, Aug 18, 2010 at 10:01 PM, Warren Bell
<wa...@clarksnutrition.com> wrote:
> I have a ListView that adds one TextField to each ListItem. These
> TextFields need to have different types of validators added to them
> depending on a condition. One TextField in the first ListItem may need
> an email validator while the TextField in the next ListItem may need a
> number range validator and so on.
>
> What is the best way to do this type of validation?
>
> Warren
>
>

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