You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Steffen <s....@gmx.de> on 2010/01/21 19:13:41 UTC

The Field 'emailInput' is required

Hello,

this is my first post and I hope you could help me.
I have a Form with the id="test" and a Textfield="EMAIL". The Textfield I added with "add(new RequiredTextField<String>("emailInput"))".
After pressing submit (wihout entering an emali), I get the failure "Field 'emailInput' is required." I want to change 'emailInput' to email. I tested in the properties.

test.EMAIL.Required=test
EMAIL.Required=test
but it doesn't work. The propertie file must work, I can change the submit text.  
Do you have any idea?
-- 
Haiti-Nothilfe! Helfen Sie per SMS: Sende UIHAITI an die Nummer 81190.
Von 5 Euro je SMS (zzgl. SMS-Gebühr) gehen 4,83 Euro an UNICEF.

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


RE: The Field 'emailInput' is required

Posted by Jeffrey Schneller <je...@envisa.com>.
Actually, this is how you would do it.  Or at least how I did it in the
past.

If you call setLabel on the input component and the value you pass to
set label can come from the xml file based on the language using the
StringResourceModel.  
Example:

Java Code (myform.java):
RequiredTextField firstName = new RequiredTextField("firstName");
firstName.setLabel(new StringResourceModel("firstName", this, null));

Xml File:

English (myform.xml):
<properties>	
	<entry key="firstName">forename</entry>
</properties>


German (myform_de.xml):
<properties>	
	<entry key="firstName">Vorname</entry>
</properties>


You can also customize the error messages as others have shown and you
can have both English and German error messages.



-----Original Message-----
From: Whats'Up [mailto:s.abel-ba@gmx.de] 
Sent: Thursday, January 21, 2010 2:52 PM
To: users@wicket.apache.org
Subject: Re: The Field 'emailInput' is required


No this it isn't.
A better example, I have 2 properties files (german and englisch)
English: Field 'forenameInput' is required.
German: Bitte tragen Sie einen Wert im Feld 'forenameInput' ein.
These both texts wicket generates by using "add(new
RequiredTextField<String>("forenameInput"))". 
These both texts are great, but I want to change the forenameInput to
"forename" in the englisch properties file and in the german to
"Vorname"
without writing the whole error code.




svenmeier wrote:
> 
> FormComponent#setLabel() ?
> 
> Sven
> 
> Whats'Up wrote:
>> Sorry, I think I wrote not enough, to tell you the problem.
>> With the code test.emailInput.Required=The Email address is required:
I
>> have
>> to write for every field the same code, but the wicket code is ok,
and I
>> thought it is perhaps possible only to change the field name.
>> Normally I get the error code: Field 'emailInput' is required.
>> I only want to change the field-name and not the completely
error-code.
>> The
>> standart wicket-error code ist ok, and I only want to change the
field
>> name,
>> because I have very much fields.
>>
>>
>>
>>   
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context:
http://old.nabble.com/The-Field-%27emailInput%27-is-required-tp27262234p
27263504.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
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: The Field 'emailInput' is required

Posted by Whats'Up <s....@gmx.de>.
No this it isn't.
A better example, I have 2 properties files (german and englisch)
English: Field 'forenameInput' is required.
German: Bitte tragen Sie einen Wert im Feld 'forenameInput' ein.
These both texts wicket generates by using "add(new
RequiredTextField<String>("forenameInput"))". 
These both texts are great, but I want to change the forenameInput to
"forename" in the englisch properties file and in the german to "Vorname"
without writing the whole error code.




svenmeier wrote:
> 
> FormComponent#setLabel() ?
> 
> Sven
> 
> Whats'Up wrote:
>> Sorry, I think I wrote not enough, to tell you the problem.
>> With the code test.emailInput.Required=The Email address is required: I
>> have
>> to write for every field the same code, but the wicket code is ok, and I
>> thought it is perhaps possible only to change the field name.
>> Normally I get the error code: Field 'emailInput' is required.
>> I only want to change the field-name and not the completely error-code.
>> The
>> standart wicket-error code ist ok, and I only want to change the field
>> name,
>> because I have very much fields.
>>
>>
>>
>>   
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/The-Field-%27emailInput%27-is-required-tp27262234p27263504.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: The Field 'emailInput' is required

Posted by Sven Meier <sv...@meiers.net>.
FormComponent#setLabel() ?

Sven

Whats'Up wrote:
> Sorry, I think I wrote not enough, to tell you the problem.
> With the code test.emailInput.Required=The Email address is required: I have
> to write for every field the same code, but the wicket code is ok, and I
> thought it is perhaps possible only to change the field name.
> Normally I get the error code: Field 'emailInput' is required.
> I only want to change the field-name and not the completely error-code. The
> standart wicket-error code ist ok, and I only want to change the field name,
> because I have very much fields.
>
>
>
>   


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


Re: The Field 'emailInput' is required

Posted by Whats'Up <s....@gmx.de>.
Thank you for the fast answer. A custom validator, I don't want to write,
because it must be easier.
The strange think is, that wicket uses the value "emailInput" or "forename"
and I hope to change these values with the properties.



rmattler wrote:
> 
> Still not sure I understand your problem.  If the field names are the same
> on many forms, I.E. an email field on several forms, you can put the error
> message in the application.properties file.
> 
> If my application is MyApplication.java then create a
> MyApplication.properties file and put in the validation.
> PasswordValidator= The Password must contain a number and a letter and be
> 6 characters long.
> 
> Or you can create a custom validator and create your own default message.
> 
> Hope that helps.
> 
> 
> 
> Whats'Up wrote:
>> 
>> Sorry, I think I wrote not enough, to tell you the problem.
>> With the code test.emailInput.Required=The Email address is required: I
>> have to write for every field the same code, but the wicket code is ok,
>> and I thought it is perhaps possible only to change the field name.
>> Normally I get the error code: Field 'emailInput' is required.
>> I only want to change the field-name and not the completely error-code.
>> The standart wicket-error code ist ok, and I only want to change the
>> field name, because I have very much fields.
>> 
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://old.nabble.com/The-Field-%27emailInput%27-is-required-tp27262234p27263586.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: The Field 'emailInput' is required

Posted by rmattler <Ro...@gmail.com>.
Still not sure I understand your problem.  If the field names are the same on
many forms, I.E. an email field on several forms, you can put the error
message in the application.properties file.

If my application is MyApplication.java then create a
MyApplication.properties file and put in the validation.
PasswordValidator= The Password must contain a number and a letter and be 6
characters long.

Or you can create a custom validator and create your own default message.

Hope that helps.



Whats'Up wrote:
> 
> Sorry, I think I wrote not enough, to tell you the problem.
> With the code test.emailInput.Required=The Email address is required: I
> have to write for every field the same code, but the wicket code is ok,
> and I thought it is perhaps possible only to change the field name.
> Normally I get the error code: Field 'emailInput' is required.
> I only want to change the field-name and not the completely error-code.
> The standart wicket-error code ist ok, and I only want to change the field
> name, because I have very much fields.
> 
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/The-Field-%27emailInput%27-is-required-tp27262234p27263523.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: The Field 'emailInput' is required

Posted by Whats'Up <s....@gmx.de>.
Sorry, I think I wrote not enough, to tell you the problem.
With the code test.emailInput.Required=The Email address is required: I have
to write for every field the same code, but the wicket code is ok, and I
thought it is perhaps possible only to change the field name.
Normally I get the error code: Field 'emailInput' is required.
I only want to change the field-name and not the completely error-code. The
standart wicket-error code ist ok, and I only want to change the field name,
because I have very much fields.



rmattler wrote:
> 
> Java code: (VendorSignupEntry.java)
> 
> Form<VendorProfile> form = new Form<VendorProfile>("vendorSignupForm",
> 				new CompoundPropertyModel<VendorProfile>(profileModel))
> 
> RequiredTextField<String> mainEmail = new
> RequiredTextField<String>("mainEmail");
> 
> HTML: (VendorSignupEntry.html)
> 
> <form wicket:id="vendorSignupForm">
> <input wicket:id="mainEmail" size="40" maxlength="40">
> 
> 
> Properties: (VendorSignupEntry.properties)
> 
> vendorSignupForm.mainEmail.Required=The Email address is required.
> vendorSignupForm.mainEmail.StringValidator.maximum=The Email address must
> between less than ${maximum} letters.
> vendorSignupForm.mainEmail.EmailAddressValidator=The Email address is not
> a valid address.
> 
> 
> 
> Whats'Up wrote:
>> 
>> Hi rmattler and Wilhelmsen Tor Iver
>> 
>> thank you both for the fast answers! With "test.emailInput.Required=test"
>> I changed the completely error code to "test", but how can I change the
>> error code to this "Field 'email' is required." ?
>> I also tested it with  test.emailInput.RequiredValidator=email, but it
>> doesn't work
>> 
>> rmattler wrote:
>>> 
>>> try:  test.emailInput.Required=test
>>> 
>> 
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://old.nabble.com/The-Field-%27emailInput%27-is-required-tp27262234p27263298.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: The Field 'emailInput' is required

Posted by rmattler <Ro...@gmail.com>.
Java code: (VendorSignupEntry.java)

Form<VendorProfile> form = new Form<VendorProfile>("vendorSignupForm",
				new CompoundPropertyModel<VendorProfile>(profileModel))

RequiredTextField<String> mainEmail = new
RequiredTextField<String>("mainEmail");

HTML: (VendorSignupEntry.html)

<form wicket:id="vendorSignupForm">
<input wicket:id="mainEmail" size="40" maxlength="40">


Properties: (VendorSignupEntry.properties)

vendorSignupForm.mainEmail.Required=The Email address is required.
vendorSignupForm.mainEmail.StringValidator.maximum=The Email address must
between less than ${maximum} letters.
vendorSignupForm.mainEmail.EmailAddressValidator=The Email address is not a
valid address.



Whats'Up wrote:
> 
> Hi rmattler and Wilhelmsen Tor Iver
> 
> thank you both for the fast answers! With "test.emailInput.Required=test"
> I changed the completely error code to "test", but how can I change the
> error code to this "Field 'email' is required." ?
> I also tested it with  test.emailInput.RequiredValidator=email, but it
> doesn't work
> 
> rmattler wrote:
>> 
>> try:  test.emailInput.Required=test
>> 
> 
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/The-Field-%27emailInput%27-is-required-tp27262234p27263033.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: The Field 'emailInput' is required

Posted by Whats'Up <s....@gmx.de>.
Hi rmattler

thank you for the fast answer! With "test.emailInput.Required=test" I
changed the completely error code to "test", but how can I change the error
code to this "Field 'email' is required." ?
I also tested it with  test.emailInput.RequiredValidator=email, but it
doesn't work

rmattler wrote:
> 
> try:  test.emailInput.Required=test
> 



-- 
View this message in context: http://old.nabble.com/The-Field-%27emailInput%27-is-required-tp27262234p27262883.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: The Field 'emailInput' is required

Posted by rmattler <Ro...@gmail.com>.
try:  test.emailInput.Required=test



Whats'Up wrote:
> 
> Hello,
> 
> this is my first post and I hope you could help me.
> I have a Form with the id="test" and a Textfield="EMAIL". The Textfield I
> added with "add(new RequiredTextField<String>("emailInput"))".
> After pressing submit (wihout entering an emali), I get the failure "Field
> 'emailInput' is required." I want to change 'emailInput' to email. I
> tested in the properties.
> 
> test.EMAIL.Required=test
> EMAIL.Required=test
> but it doesn't work. The propertie file must work, I can change the submit
> text.  
> Do you have any idea?
> -- 
> Haiti-Nothilfe! Helfen Sie per SMS: Sende UIHAITI an die Nummer 81190.
> Von 5 Euro je SMS (zzgl. SMS-Gebühr) gehen 4,83 Euro an UNICEF.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/The-Field-%27emailInput%27-is-required-tp27262234p27262676.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: The Field 'emailInput' is required

Posted by thisisme <90...@gmx.de>.
they appear in the same order as you add the fields to the form. so by
changing this order, you will change the order of the messages, too


Whats'Up wrote:
> 
> 
> Do you know how I can order the error-codes?
> 
> 

-- 
View this message in context: http://old.nabble.com/The-Field-%27emailInput%27-is-required-tp27262234p27263872.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: The Field 'emailInput' is required

Posted by Whats'Up <s....@gmx.de>.
@thisis me

PErfekt, this is the answer!!!!!!!!

Do you know how I can order the error-codes?


thisisme wrote:
> 
> try:
> 
> emailInput = email
> 
> in the property file
> 
> 
> Whats'Up wrote:
>> 
>> test.EMAIL.Required=test
>> EMAIL.Required=test
>> 
> 
> 

-- 
View this message in context: http://old.nabble.com/The-Field-%27emailInput%27-is-required-tp27262234p27263793.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: The Field 'emailInput' is required

Posted by thisisme <90...@gmx.de>.
try:

emailInput = email

in the property file


Whats'Up wrote:
> 
> test.EMAIL.Required=test
> EMAIL.Required=test
> 

-- 
View this message in context: http://old.nabble.com/The-Field-%27emailInput%27-is-required-tp27262234p27263737.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


SV: The Field 'emailInput' is required

Posted by Wilhelmsen Tor Iver <To...@arrive.no>.
> I have a Form with the id="test" and a Textfield="EMAIL".

Claim the first, then:

> The Textfield I added with "add(new RequiredTextField<String>("emailInput"))".

Claim the second.

These conflict, because the id used in the actual code is "emailInput".

> test.EMAIL.Required=test
> EMAIL.Required=test

So that needs to have EMAIL replaced with the id used which was emailInput.

HTH. HAND. :)

- Tor Iver

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