This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts2 Field validator is not working for mutiple textfield wich have same name. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts2 Field validator is not working for mutiple textfield wich have same name." Watch "Struts2 Field validator is not working for mutiple textfield wich have same name." New topic
Author

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

francis varkey
Ranch Hand

Joined: Sep 13, 2005
Posts: 169
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

Joined: Jul 23, 2008
Posts: 296

hi,

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

Regards
Jatan
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Struts2 Field validator is not working for mutiple textfield wich have same name.