You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Joachim Schrod <js...@acm.org> on 2014/07/25 02:52:27 UTC

Form-Validators and invisible form components

Hi,

I have a form with a date input that may be invisible. If it is
visible, its value must be after another date input's value.

I established a FormValidator that checks that condition. It knows
about the potential invisibility and handles it.

Now, for most pages Wicket outputs the warning

    IFormValidator in form `form` depends on a component that has
    been removed from the page or is no longer visible. Offending
    component id `inhaber1.arbeitSeit`.

I thought about disabling the FormValidator if its dependent
component is invisible -- but then I realized that isEnabled() of
validator-behaviors is not checked and that's not the route to go.

FWIW, I think that's a mis-feature.
Form.validateFormValidator(IFormValidator) should check
isEnabled(). Checking isEnabled() also in
FormComponent.validateValidators() is a different question, I can't
find a use case for it.

Thus, my question: how may I realize checks over several form
components where one of them may be invisible?

Here's hoping for a hint in the right direction,

	Joachim

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Joachim Schrod, Roedermark, Germany
Email: jschrod@acm.org


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


Re: Form-Validators and invisible form components

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

Please file a ticket. I agree that Wicket can use
Behavior#isEnabled(Component) to decide whether to call
I(Form)Validator#validate().

To workaround it you can use normal IValidator added to the always visible
form component and pass manually the one that may be invisible. This way
you have all the information to decide whether everything is valid.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov


On Fri, Jul 25, 2014 at 3:52 AM, Joachim Schrod <js...@acm.org> wrote:

> Hi,
>
> I have a form with a date input that may be invisible. If it is
> visible, its value must be after another date input's value.
>
> I established a FormValidator that checks that condition. It knows
> about the potential invisibility and handles it.
>
> Now, for most pages Wicket outputs the warning
>
>     IFormValidator in form `form` depends on a component that has
>     been removed from the page or is no longer visible. Offending
>     component id `inhaber1.arbeitSeit`.
>
> I thought about disabling the FormValidator if its dependent
> component is invisible -- but then I realized that isEnabled() of
> validator-behaviors is not checked and that's not the route to go.
>
> FWIW, I think that's a mis-feature.
> Form.validateFormValidator(IFormValidator) should check
> isEnabled(). Checking isEnabled() also in
> FormComponent.validateValidators() is a different question, I can't
> find a use case for it.
>
> Thus, my question: how may I realize checks over several form
> components where one of them may be invisible?
>
> Here's hoping for a hint in the right direction,
>
>         Joachim
>
> --
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> Joachim Schrod, Roedermark, Germany
> Email: jschrod@acm.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>