yep, there is certainly that.

-Igor


On 4/25/06, Johan Compagner <[EMAIL PROTECTED]> wrote:
MyCompoundValidator compound = new MyCompoundValidatior();
compound.add(XXXValidatior);
compound.add(YYYValidator);
compound.validate()
{
 iterator.next().validate()
}


component.add(compound);


compound.remove(xxx);

johan



On 4/25/06, Roan O'Sullivan <[EMAIL PROTECTED] > wrote:
Hi Igor,

I have this same requirement, also in the context of dynamic forms.

I think a simple #removeAllValidators() would do the trick without introducing ambiguity or any additional complexity. In v1.1.1 I end up reconstructing the component when, for example, I need to remove a TypeValidator. This can be a real pain.

Haven't had a chance to check out IFormValidator, and it may do what I require. However, I don't see how a #removeAllValidators() could hurt either :).

Thanks,

Roan

________________________________

From: [EMAIL PROTECTED] on behalf of Igor Vaynberg
Sent: Tue 4/25/2006 2:09 PM
To: wicket-user@lists.sourceforge.net
Subject: Re: [Wicket-user] RE: Removing a Validator


but once you introduce the map you introduce the ambiguity of evaluation order as well and it makes things more complex to manage.

also once you allow removal you alse need to allow insertion. it keeps getting messier and messier for the end user.

you can also potentially do what you want by overriding isrequired(), but you cannot then use the model of the component it depends on, only its input value.

i think a IFormValidator which delegates to a few IValidator is the cleanest way to go, but thats just my two cents.

-Igor



On 4/25/06, Andrew Strickland < [EMAIL PROTECTED]> wrote:

        My first thought was the component would have a Map of validators that you store by a validator name...that way you could add or remove like remove( IValidator.getName () )...also that way you could never end up with more than one of the same type of Validator on any given component.

        Andy


        >How would you remove the validator? Would you do it by index or by instance?
        >Its not very clean either way. Check out IFormValidator, I think it fits
        >your usecase better then an IValidator.

        >-Igor


        On 4/25/06, Andrew Strickland < [EMAIL PROTECTED] <mailto: [EMAIL PROTECTED]> > wrote:
        >

        > Was the capability added in 1.2 to remove Validators from a component?  I=
        f

        > not, are there any plans to add such a capability?
        >
        > When doing dynamic forms it is a huge convenience to be able to add and
        > remove validators based on a user selection on another field in the form.
        >

        > An example: on my project some fields are required or not depending on th=
        e

        > classification of the system.  During account creation the user has the
        > ability to choose which classification they are requesting their account =
        be
        > created for.  If they choose the more restrictive classification and then

        > change their mind and switch to the less restrictive some of the fields t=
        hat
        > I added a validator to will now STILL have the RequiredValidator even tho=
        ugh

        > it is no longer a required field, and I have no way of removing the
        > validator.
        >
        > Andy





Reply via email to