You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Evan Schnell <es...@nvisia.com> on 2003/03/12 22:42:45 UTC
Broken Client-Side Validation
I am having a great deal of trouble with client side validation on
fields that use the requiredIf rule in Struts 1.1B3 and RC1. ServerSide
validation of everything works fine and client side validation works
fine when I remove the requiredIf clause.
I have the following entry in my validation.xml file:
<field property="lastName" depends="minlength, requiredif">
<arg0 key="register.lastname"/>
<arg1 name="minlength" key="${var:minlength}" resource="false"/>
<var>
<var-name>field[0]</var-name>
<var-value>firstName</var-value>
</var>
<var>
<var-name>field-test[0]</var-name>
<var-value>NOTNULL</var-value>
</var>
<var>
<var-name>minlength</var-name>
<var-value>2</var-value>
</var>
</field>
This works perfectly on the server side but the entire validation chain
falls apart on the client side with the following Mozilla Javascript
debugger error. (The same behavior happens in IE)
Recorded local startup 2, global 218254.
Exception ``SyntaxError: invalid assignment left-hand side'' thrown from
function minlength() in <http://localhost:8080/validation/register.do>
line 30.
[e] message = [string] "invalid assignment left-hand side"
Stopped for thrown exception.
#0: function minlength() in
<http://localhost:8080/validation/register.do> line 30
028: this.ac = new Array("passwordConfirm", "Retype Password can not be
less than 4 characters.", new Function ("varName", "this.maxlength='8';
this.minlength='4'; return this[varName];"));
029: this.ad = new Array("firstName", "First Name can not be less than 2
characters.", new Function ("varName", "this.minlength='2'; return
this[varName];"));
030: this.ae = new Array("lastName", "Last Name can not be less than 2
characters.", new Function ("varName", "this.field[0]='firstName';
this.minlength='2'; this.field-test[0]='NOTNULL'; return this[varName];"));
031: }
032:
--
Evan Schnell, Technical Lead
nVISIA, Twin Cities "Digital Architecture and Construction"
7701 France Ave. S, Edina, MN 55435
Voice: 952.837.2577 -- Fax: 952.837.2578 -- Mobile: 612.232.5972