• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts2 Field validator is not working for mutiple textfield wich have same name.

 
francis varkey
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,
I have mutiple textfield wich have same name in jsp. I am using stuts2 xml validation for validating it.

in jsp

<s:textfield name="startTime" id="startTime1" />
<s:textfield name="startTime" id="startTime2" />


in xml

<field name="startTime">
<field-validator type="fieldexpression" >
<param name="expression"><![CDATA[startTime.length > 0]]></param>
<message>StartTime is required!</message>
</field-validator>
</field>

but it is not checking the text fieds are empty or not. Just checking the length of the array.

Thanks
 
jatan bhavsar
Ranch Hand
Posts: 299
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

check for the word "require" in struts2 validation frame work. Thiswill give you idea.

Regards
Jatan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic