2 Replies Latest reply on Sep 16, 2007 12:12 AM by kumlali

    Unclear validation error messages

    kumlali Newbie

      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.

        • 1. Re: Unclear validation error messages
          merry freespace Newbie

          please modify .error,add "float: left;"in css?than error messages show up nearby the fields as in booking example.

          • 2. Re: Unclear validation error messages
            kumlali Newbie

            Thanks for your quick response, freespace. I actually know how to show the error messages up nearby the fields as in booking example. I am rather interested in followings:

            - Should I prefer error messages show up nearby the fields as in booking example or should I list them all together as in registration 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