RequiredValidator

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

RequiredValidator

Sergey Podatelev
Hello Wicket people,

I'm sorry for the dumb question, but I've failed to find the solution
myself.

The problem is that I want a custom RequiredValidator message, but when I
add a "RequiredValidator=My happy message" in the RegisterPage.properties
file, nothing changes.
The system sees the file though, because adding a label for input like this:
"firstName=Firstname11" is reflected in the feedback messages.

The structure is the following: RegisterForm extends AddUserForm extends
UserForm contains FeedbackPanel.

--
sp
Reply | Threaded
Open this post in threaded view
|

Re: RequiredValidator

Mathias P.W Nilsson
What version of wicket are you using.

From the 1.2 snapshot wich was a while ago

=================================
This validator has been deprecated in favor of FormComponent.setRequired(boolean) Validator that ensures a component has a non-null and non-empty value. If the component's value is null or empty (a value is considered empty if it just contains whitespace) when its containing form is submitted then the errorMessage() method will be called by the framework.
=================================

If you use form.setRequired( true ) and just use Required=${label} is required it should work.

Hope this works

// Mathias
Reply | Threaded
Open this post in threaded view
|

Re: RequiredValidator

Sergey Podatelev
Yep, that was it.
Thanks a bunch, now I gotta enhance my googling skills.

On Sun, Apr 20, 2008 at 8:20 PM, Mathias P.W Nilsson <[hidden email]>
wrote:

>
> What version of wicket are you using.
>
> From the 1.2 snapshot wich was a while ago
>
> =================================
> This validator has been deprecated in favor of
> FormComponent.setRequired(boolean) Validator that ensures a component has
> a
> non-null and non-empty value. If the component's value is null or empty (a
> value is considered empty if it just contains whitespace) when its
> containing form is submitted then the errorMessage() method will be called
> by the framework.
> =================================
>
> If you use form.setRequired( true ) and just use Required=${label} is
> required it should work.
>
> Hope this works
>
> // Mathias
>
> --
> View this message in context:
> http://www.nabble.com/RequiredValidator-tp16795271p16795401.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
sp
Reply | Threaded
Open this post in threaded view
|

Re: RequiredValidator

mrblobby
Hi, I dont see how this reply solves the problem.

The forms fields have this:
passwordField.setRequired(true);

the Page.properties file has the following structure:
Form.FeildName=fieldname
RequiredValidator=Holy cow, ${lablel} is blank.

This works fine, except the "Required Validator" part of the properties file does seem to work any more.  I.e. it picks up the Form.Fieldname but not the RequiredValidator patterns.

I am aware that RequiredValidator has been depricated, and there is no direct replacement, but how do you get the "RequiredValidator" string functionality back?  E.g. if you need to translate the default "Field 'xx' is required." which is hard coded into reply a the moment?

Which class has an onErrorMessage() call?  The form has a bunch of error methods which presumably can be overridden, but not this one.

Many thanks for any help!
Reply | Threaded
Open this post in threaded view
|

Re: RequiredValidator

jcgarciam
See if this can help:

From the link aboves:


--- 
Changes in Wicket 1.3

Whether a field is required is now determined by testing the isRequired() method of FormComponent, therefore 'RequiredValidator' in the above examples has to be replaced by 'Required'.

---


On Wed, Dec 15, 2010 at 10:29 AM, mrblobby [via Apache Wicket] <[hidden email]> wrote:
Hi, I dont see how this reply solves the problem.

The forms fields have this:
passwordField.setRequired(true);

the Page.properties file has the following structure:
Form.FeildName=fieldname
RequiredValidator=Holy cow, ${lablel} is blank.

This works fine, except the "Required Validator" part of the properties file does seem to work any more.  I.e. it picks up the Form.Fieldname but not the RequiredValidator patterns.

I am aware that RequiredValidator has been depricated, and there is no direct replacement, but how do you get the "RequiredValidator" string functionality back?  E.g. if you need to translate the default "Field 'xx' is required." which is hard coded into reply a the moment?

Which class has an onErrorMessage() call?  The form has a bunch of error methods which presumably can be overridden, but not this one.

Many thanks for any help!


View message @ http://apache-wicket.1842946.n4.nabble.com/RequiredValidator-tp1864291p3088996.html
To start a new topic under Apache Wicket, email [hidden email]
To unsubscribe from Apache Wicket, click here.



--
Sincerely,
JC (http://www.linkedin.com/in/jcgarciam)
--Anyone who has never made a mistake has never tried anything new.--