Announcement Announcement Module
Collapse
No announcement yet.
How to check errors for a form field? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to check errors for a form field?

    Hi,
    I have a form with eg. 5 fields, one of the fields is required, I can show error message as:
    Code:
    <c&#58;out value="$&#123;status.errorMessage&#125;" />
    but I wanted it nice formated (add div, img html tags), so I need to check if theere is an error first.
    How can I do this? Is there any Spring tags, or I need to write a scriplet?
    I found method hasFieldErrors(String field) but how can I get errors instance related for field it matches?

    Best Regards,
    Lee

  • #2
    Code:
    <c&#58;if test="$&#123;not empty status.errorMessages&#125;">
    </c&#58;if>

    Comment


    • #3
      I use :

      Code:
      <spring&#58;bind path="bean.name">
      <td><input name="<c&#58;out value="$&#123;status.expression&#125;"/>"
       value="<c&#58;out value="$&#123;status.value&#125;"/>" type="text" >
      <FONT color="red" size="0"><c&#58;out value="$&#123;status.errorMessage&#125;"><FONT></spring&#58;bind>
      </td>

      Comment

      Working...
      X