Re: Mask validation BUG with requiredif

2003-03-13 Thread Evan Schnell
Greg Hess wrote:

Hi All, 

I have just started using the requiredif validation rule with a field
that is also being validated with a mask rule. The server side
validation is working fine but the client side JavaScript has errors for
my requiredif form fields. 
 

I cannot seem to get any client-side validation to work when requiredif 
is turned on.  I wrote my own javascript rule that is supposed to always 
return true.  However mozilla's javascript engine (and presumably IE's 
because both give the same end behavior) will not allow a variable to be 
named "field-test" or "field-join".  

Specifically the bug is in:

this.ae = new Array("lastName", "Last Name can not be less than 2 
characters.", new Function ("varName", "this.field[0]='firstName'; 
this.field-test[0]='NOTNULL'; this.minlength=2;  return this[varName];"));

The only workaround I can see is to follow advice previously posted on 
this list and not attempt client side "requiredif,"  Then I can hack 
JavascriptValidatorTag.java to support a new jsType called "omit" which 
will prevent the variable from being included in the javascript at all.

Regards, Evan.



smime.p7s
Description: S/MIME Cryptographic Signature


Mask validation BUG with requiredif

2003-03-13 Thread Greg Hess
Hi All, 
 
I have just started using the requiredif validation rule with a field
that is also being validated with a mask rule. The server side
validation is working fine but the client side JavaScript has errors for
my requiredif form fields. 
My form field requires the feild button2URL only if button2Lbl has been
entered and if button2URL it must pass the mask rule. 
 
When I use my mask without the requiredif rule all is well in client
JavaScript the generated method is as follows:
 
function mask () { 
 this.aa = new Array("button2URL", "Button 2 URL must contain a
valid URL. For more information click the help icon.", new Function
("varName", "this.mask=/^http:\\/\\/|^file:\\/\\/|^mailto:[^ ]*$/;
return this[varName];"));
} 
 
When the requiredif rule is added and the JavaScript breaks and the
generated method is:
 
function mask () { 
 this.aa = new Array("button2URL", "Button 2 URL must contain a
valid URL. For more information click the help icon.", new Function
("varName", "this.field-test[0]='NOTNULL'; this.field[0]='button2Lbl';
this.mask=/^http:\\/\\/|^file:\\/\\/|^mailto:[^ ]*$/;  return
this[varName];"));
} 
 
Below is my validation def for this form:
 

 

 

 

 

 

 

 
mask
 
^http:\/\/|^file:\/\/|^mailto:[^ ]*$
 

 

 
field[0]
 
button2Lbl
 

 

 
field-test[0]
 
NOTNULL
 
 
 

 

 
I have accepted that for now I will create my own static JavaScript for
the form to handle the requirdif fields but I would still like to use
the other rules and their client side validation with my reqiredif
fields. 
 
Many thanks,
 
Greg