aspose file tools*
The moose likes Struts and the fly likes Struts Indexed properties client side validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Indexed properties client side validation" Watch "Struts Indexed properties client side validation" New topic
Author

Struts Indexed properties client side validation

Peterneo Andersonneo
Greenhorn

Joined: Mar 22, 2006
Posts: 5
Can anybody help me out on how to validate indexed properties on client side?
Bharat Athreya
Greenhorn

Joined: Mar 09, 2006
Posts: 10
Can you please provide some more informationto help you!!!


Bharat Athreya
Peterneo Andersonneo
Greenhorn

Joined: Mar 22, 2006
Posts: 5
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

Joined: Mar 28, 2006
Posts: 7
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!


My English is poor. Sigh!!!
Peterneo Andersonneo
Greenhorn

Joined: Mar 22, 2006
Posts: 5
client side validation is not supported for indexed properties.
 
 
subject: Struts Indexed properties client side validation