• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Indexed properties and html:javascript

 
Henrik Lund
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!

I've just managed to set up indexed properties and server-side validation in my Struts application. My bean is called AddUserBean and contains a ArrayList named userListArray with User objects (name, ...).

The problem is that the client-side validation (using html:javascript) doesn't work as expected (see below). I'm using the Jakarta Commons Validator plug-in.


This is how my validation.xml looks like:


And this is from my JSP:


The generated HTML code from the html:javascript looks like:


Anyone got some idea of why the Javascript validation doesn't work, and the server-side does?

Is it even poosible to have client-side validation when using indexed properties? Maybe there is a bug in the Validator plugin?

Regards,
Henrik
 
rogel garcia
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The client side validation for indexed properties on struts was not done! You will have to change something in the struts to enable javascript validation on indexed properties. This link shows you how to do that http://www.vleite.net/rogel/javascriptValidation.htm
Any doubts write to the email on the article
 
Peterneo Andersonneo
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://www.vleite.net/rogel/javascriptValidation.htm

This link is not accessible can some body tell how to do client side validations on indexed properties.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have the following in your <html:form> tag?

onsubmit="return validateUserFormBean(this)"

If not, that's the problem.
 
Peterneo Andersonneo
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>>Do you have the following in your <html:form> tag?

>>onsubmit="return validateUserFormBean(this)"

>>If not, that's the problem.

Ya, I have all there even I am able to see the javascript getting generated through <html:javascript> but the bowrser shows script error on submitting the form.
 
rogel garcia
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry about the broken link...

http://us.f13.yahoofs.com/bc/442075a1m94628437/bc/HTML/JS+Validation+Indexed+Prop.zip?bfUdBuEBne5jE5Yd

This link is a ZIP file with all the necessary files
 
rogel garcia
Ranch Hand
Posts: 41
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic