You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Eric Weidner <er...@ejbsolutions.com> on 2002/11/03 01:35:53 UTC

problem using the 1.1b2 validator dependency feature

I am running Struts 1.1b2 on Jboss 3.0.3 w/ Tomcat 4.1.12 with JDK 1.4.1 
on Windows XP.

I have a form page that is validating nicely using required, maxlength, 
integer, range, and mask validations on various fields.  I want to 
change a field so that it is only required if another field equals a 
certain value.

I changed my validation.xml for the dependent field to look as follows,

       <field property="field2" depends="requiredif,mask,maxlength">
         <msg name="mask" key="errors.mask"/>
         <arg0 key="myForm.field2.label"/>
         <arg1 name="maxlength" key="${var:maxlength}" resource="false"/>
         <var>
           <var-name>mask</var-name>
           <var-value>${defaultMask}</var-value>
         </var>
         <var>
           <var-name>maxlength</var-name>
           <var-value>20</var-value>
         </var>

         <var>
           <var-name>field[0]</var-name>
           <var-value>field1</var-value>
         </var>
         <var>
           <var-name>field-test[0]</var-name>
           <var-value>EQUAL</var-value>
         </var>
         <var>
           <var-name>field-value[0]</var-name>
           <var-value>myvalue</var-value>
         </var>

       </field>

where field1 is a hidden field that gets filled in at submit time before 
the validation is called.

When I try to hit this page after making this change, I get the 
following during page compilation...

       [ServletException in:/content/register/register.jsp] null'

where the debug log indicates that a null pointer exception is thrown 
when trying to generate the javascript.

2002-11-02 13:09:34,313 ERROR [org.jboss.web.localhost.Engine] ----- 
Root Cause -----
java.lang.NullPointerException
	    at 
org.apache.struts.taglib.html.JavascriptValidatorTag.doStartTag(JavascriptValidatorTag.java:297)
	at 
org.apache.jsp.register_jsp._jspx_meth_html_javascript_0(register_jsp.java:1445)
	at org.apache.jsp.register_jsp._jspService(register_jsp.java:558)


I thought this may indicate that I was missing a required key in my 
ApplicationResources.properties, so I added an entry for 
errors.requiredif, but no luck.

Am I missing something here?

Thanks

Eric



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: problem using the 1.1b2 validator dependency feature

Posted by Eric Weidner <er...@ejbsolutions.com>.
I'm now using the 20021102 1.1 nightly build and I get the following 
java script error when submitting the page.

Error: invalid assignment left-hand side
Source Code:
this.field-test[0]='NOTNULL'; this.maxlength='20'; 
this.field[0]='field1'; this.mask=/^[a-zA-Z0-9\-]*$/;  return this[varName];

I get the same error trying to use EQUAL.  This bombs all the validation.

The error message is from Mozilla, but the javascript fails in IE as well.

Any ideas?

Rob Leland wrote:

> Eric Weidner wrote:
>
>> Yes, this is truly 1.1b2 and that is the line that failed.  I figured
>> the "requiredif" was in there since the documentation mentioned it as 
>> a feature in 1.1. 
>
>
>
> When downloading a struts version always refer to the version of the
> docs that come with that download. The docs on the web site tend to 
> reflect functionality of the current nightly build.
>
>>
>> BTW, was one of the bugs that was fixed validating max and min length on
>> password fields?
>
>
> I don't believe so, I had seen something mentioned in the news group
> in the last week about that. If there is a problem then file a 
> bugzilla bug report.

Will do when I get time to write up a proper bug.




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: problem using the 1.1b2 validator dependency feature

Posted by Rob Leland <rl...@apache.org>.
Eric Weidner wrote:

> Yes, this is truly 1.1b2 and that is the line that failed.  I figured
> the "requiredif" was in there since the documentation mentioned it as 
> a feature in 1.1. 


When downloading a struts version always refer to the version of the
docs that come with that download. The docs on the web site tend to 
reflect functionality of the current nightly build.

>
> BTW, was one of the bugs that was fixed validating max and min length on
> password fields?

I don't believe so, I had seen something mentioned in the news group
in the last week about that. If there is a problem then file a bugzilla 
bug report.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: problem using the 1.1b2 validator dependency feature

Posted by Eric Weidner <er...@ejbsolutions.com>.
Yes, this is truly 1.1b2 and that is the line that failed.  I figured 
the "requiredif" was in there since the documentation mentioned it as a 
feature in 1.1.  I'll get a nightly and try that.

BTW, was one of the bugs that was fixed validating max and min length on 
password fields?

Thanks,

Eric

Rob Leland wrote:

> Eric Weidner wrote:
>
>> I am running Struts 1.1b2 on Jboss 3.0.3 w/ Tomcat 4.1.12 with JDK 
>> 1.4.1 on Windows XP.
>
>
> Is this truely Struts 1.1B2, or a nightly ?
> The "requiredif" javascript method wasn't
> added until Oct 18 or so. Mixing different
> functionality from 1.1B2 & a nightly build
> will get you unknown results and puzzled looks :-)!
> Also the date of the commons-*.jars should
> match the date of struts.
>
>> java.lang.NullPointerException
>>         at
>> org.apache.struts.taglib.html.JavascriptValidatorTag.doStartTag(JavascriptValidatorTag.java:297) 
>>
>
>
> If it is truely 1.1B2 then it died at
> String javascript = va.getJavascript();
>
> I would try the nightly build. The validator
> code has had about 6 bugs fixed sinse B2.
>
> -Rob
>
>
> --
> To unsubscribe, e-mail:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>
>
>
>





--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: problem using the 1.1b2 validator dependency feature

Posted by Rob Leland <rl...@apache.org>.
Eric Weidner wrote:

> I am running Struts 1.1b2 on Jboss 3.0.3 w/ Tomcat 4.1.12 with JDK 
> 1.4.1 on Windows XP.

Is this truely Struts 1.1B2, or a nightly ?
The "requiredif" javascript method wasn't
added until Oct 18 or so. Mixing different
functionality from 1.1B2 & a nightly build
will get you unknown results and puzzled looks :-)!
Also the date of the commons-*.jars should
match the date of struts.

> java.lang.NullPointerException
>         at
> org.apache.struts.taglib.html.JavascriptValidatorTag.doStartTag(JavascriptValidatorTag.java:297) 
>

If it is truely 1.1B2 then it died at
String javascript = va.getJavascript();

I would try the nightly build. The validator
code has had about 6 bugs fixed sinse B2.

-Rob


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>