• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts Indexed properties client side validation

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anybody help me out on how to validate indexed properties on client side?
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
client side validation is not supported for indexed properties.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic