Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts Indexed properties client side validation

 
Peterneo Andersonneo
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anybody help me out on how to validate indexed properties on client side?
 
Bharat Athreya
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you please provide some more informationto help you!!!
 
Peterneo Andersonneo
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having a simple form with indexed properties. I want to validate the form on client side for simple validations such as required,mask. I am even able to see the javascript by viewing the source of the jsp, but when the form is submitted the browser shows script error.
 
yin jiang
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the same question. Below is my code:
================JSP CODE START===============
<html:form action="/setuser" >
<% for (int i = 0; i < LENGTH; i ++ ) { %>
<tr><td align="center"><html:text property='<%= "user[" + i + "]"%>' size="4" maxlength="4"/></td>
<% } %>
</html:form>
================JSP CODE END=================

================struts-config.xml start=========
<form-bean name="setuserForm" type="cn.justsystem.struts.form.SetuserForm">
<form-property size="9" name="users" type="java.lang.String[]" />
</form-bean>
================struts-config.xml end=========

I'm writing my validation.xml as below:
================validation.xml start===============
<form name="setuserForm">
<field property="users[0]" depends="short">
<msg name="short" key="errors.short"/>
</field>
</form>
================validation.xml end=================

But if i want to validate all of users property with save validation rules, i have to write the same part as above nine times.
Are there any good way to validate them?
Thanks!
 
Peterneo Andersonneo
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
client side validation is not supported for indexed properties.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic