You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Andy Schmidgall <as...@sedonaesolutions.com> on 2003/12/10 18:57:42 UTC

JavaScript validation of indexed properties

Hello,

I'm using Struts 1.1, and I have a jsp that is using indexed fields that
I need to validate using javascript. It seems as though the struts
validator just ignores javascript validations on my fields completely!
For example, if it is the only field that uses a particular validator,
say integer, an "IntegerValidations()" javascript initializer function
is generated, but it has no content. Is there anyway to do javascript
validation with the struts validator? Other javascript validations work
properly. I can write a custom validator if that would work, but I'd
rather not if I don't have to.

Thanks,
Andy



Here's the relevant form definition from struts-config:
<form-bean name="SubscriptionForm"
    type="org.apache.struts.action.DynaActionForm">
...
	<form-property name="subscriptionDetails"
type="java.util.Vector"/>
...
</form-bean>

And the jsp section:
  <logic:iterate id="line" name="SubscriptionForm"
property="subscriptionDetails">
    <tr align="left">
      <td><bean:write name="line"
property="location.locationName"/></td>
  
      <td></td>
      <td class="formDataRequired"><html:text name="line"
property="safetyMinQty" indexed="true" size="6"/></td>
      <td ></td>
      <td class="formDataRequired"><html:text name="line"
property="safetyMaxQty" indexed="true" size="6"/></td>
      <td></td>
      <td class="formDataRequired"><html:text name="line"
property="allocatedMinQty" indexed="true" size="6"/></td>
      <td></td>
      <td class="formDataRequired"><html:text name="line"
property="allocatedMaxQty" indexed="true" size="6"/></td>
    </tr>
  </logic:iterate>

And the validation rules:
        <form name="SubscriptionForm">
		...
            <field property="safetyMinQty" indexedListProperty="line"
depends="required">
                <arg0
key="SubscriptionForm.subscriptionDetails.displayname"/>
            </field>
        </form>    

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