Win a copy of Terraform in Action this week in the Cloud 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Indexed properties and html:javascript

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic