wood burning stoves 2.0*
The moose likes Struts and the fly likes Indexed properties and html:javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Indexed properties and html:javascript" Watch "Indexed properties and html:javascript" New topic
Author

Indexed properties and html:javascript

Henrik Lund
Greenhorn

Joined: Nov 28, 2003
Posts: 9
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

Joined: Dec 19, 2003
Posts: 41
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


SCJP 1.4
Peterneo Andersonneo
Greenhorn

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

Joined: Feb 15, 2005
Posts: 4864
Do you have the following in your <html:form> tag?

onsubmit="return validateUserFormBean(this)"

If not, that's the problem.


Merrill
Consultant, Sima Solutions
Peterneo Andersonneo
Greenhorn

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

Joined: Dec 19, 2003
Posts: 41
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

Joined: Dec 19, 2003
Posts: 41
http://www.geocities.com/idrogelgarcia/jsStruts.zip

NOW THIS IS A GOOD LINK


HTML Version

http://www.geocities.com/idrogelgarcia/javascriptValidation.htm
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Indexed properties and html:javascript
 
Similar Threads
Validation failure
Validator framework
Client-side validation isn't working for me!!
STRUTS: client-side validation in jsp using DynaValidatorForm
dynamicJavascript