Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Indexed properties and html:javascript

 
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
 
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
 
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.
 
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
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://www.geocities.com/idrogelgarcia/jsStruts.zip

NOW THIS IS A GOOD LINK


HTML Version

http://www.geocities.com/idrogelgarcia/javascriptValidation.htm
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic