[jboss-user] [JBoss Seam] - Unclear validation error messages

kumlali do-not-reply at jboss.com
Sat Sep 15 21:13:40 EDT 2007


Hi,

In registration example, when I leave blank all the fields and submit the form, following error comes up:

* j_id2:j_id6: Validation Error: Value is required. 
* j_id2:j_id8: Validation Error: Value is required. 
* j_id2:j_id10: Validation Error: Value is required.

What I see from this is, all the messages listed together without clearly addressing the fields causing the error. "j_id2:j_id6" does not mean anything to the user, I beleive. I found that the messages came from JSF RI's Messages.properties file[1]. 

To surpass this, I copied messages_en.properties[2] found in seam-gen/resources under to WEB-INF/classes. This time I got following:

* value is required 
* value is required 
* value is required

Well, no "j_id2:j_id6" this time. But, again, there is no clear indication of what error message belongs to which field.

I am not satisfied in either case, actually. What I expect is to see label names associated with their own messages:

messages_en.properties
javax.faces.component.UIInput.REQUIRED=value is required
registration.form.username.label=Username
registration.form.real_name.label=Real Name
registration.form.password.label=Password

Output
* Username value is required 
* Real Name value is required 
* Password value is required

I also expect Seam to show i18 label names and messages, as well:

messages_tr.properties
javax.faces.component.UIInput.REQUIRED=alani zorunludur
registration.form.username.label=Kullanici Adi
registration.form.real_name.label=Gercek Ad
registration.form.password.label=Sifre

Output
* Kullanici Adi alani zorunludur
* Gercek Ad alani zorunludur
* Sifre alani zorunludur

But, if I wanted to show error messages immediately after the field which is the reason of error, "value is required" alone would be enough. Registration form in booking example uses this approach.

In conclusion, two questions come into my mind:
- Should I prefer error messages show up nearby the fields as in booking example?

- If I choose to show all the messages together, as in registration example, does Seam allow me to show i18 label names embedded in the error messages? If yes, how?

Regards,

Ali Sadik Kumlali

----------------------------------

[1] JSF RI - Messages.properties 
  javax.faces.component.UIInput.REQUIRED={0}: Validation Error: Value is required.

Here is the whole file: http://tinyurl.com/23glwk

[2] seam-gen/resources/messages_en.properties
  javax.faces.component.UIInput.REQUIRED=value is required.


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4084792#4084792

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4084792



More information about the jboss-user mailing list