You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Terry Roe <li...@terryroe.com> on 2004/09/10 21:27:06 UTC

indexedListProperty and JavaScript Validation

Greetings,

I have searched and searched for information about using JavaScript with 
the indexedListProperty of the Validator.  I've seen many people asking 
about this problem, but no clear solutions or definitive answers as to 
whether this is supported in Struts.  I am using Struts 1.2.2, so I have 
the latest and greatest (at the moment).  Here's a clip from my 
validation.xml:

<!-- Phases -->
<field property="proposedDateOfService" indexedListProperty="plan.phaseList"
	depends="required,date">
	<arg0 key="procedure.proposedDate" />
	<var>
		<var-name>datePattern</var-name>
		<var-value>MM/dd/yyyy</var-value>
	</var>
</field>

This works for server-side validation.  However, no JavaScript is 
generated for this field, or others like it.  I have fields such as 
"plan.dateOfService" earlier in my validation.xml file that do generate 
JavaScript and the client-side validation works for them.  It appears 
that either the JavaScript can't be generated for items with 
indexedListProperty, or it's not yet supported in Struts, or...

I would like to get a definitive answer as to whether this is supported 
in Struts and, if so, how to do it.  Or I would like to know that it is 
not possible, or likely, that Struts will ever be able to do this.

I know it's possible to generate JavaScript for indexed properties 
because I am doing it manually in other places.  (If I ever get the 
time, perhaps I'll write some custom code to generate the validation 
code automatically.)  However, it seems like Struts would be much more 
useful if it could handle things like this, as well as another issue I 
will be bringing up shortly.  If it's just a matter of "we haven't got 
there, yet" that's cool.  I'd just like to know one way or the other.

Any help and/or information is greatly appreciated.

TR


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org