You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mick Knutson <mi...@hotmail.com> on 2003/06/25 17:52:43 UTC

requiredif question

I have the following code that does not seem to operate at all.

I want phone1type to be a required field _if_ the phone1 attribute is _not_ 
""

            <field  property="phone1type"
                    depends="requiredif">
                <arg0 key="form.phone1type"/>
                <var>
                    <var-name>field[0]</var-name>
                    <var-value>phone1</var-value>
                </var>
                <var>
                    <var-name>fieldTest[0]</var-name>
                    <var-value>NOTNULL</var-value>
                </var>
                <var>
                    <var-name>field[1]</var-name>
                    <var-value>phone1</var-value>
                  </var>
                  <var>
                    <var-name>fieldTest[1]</var-name>
                    <var-value>NOTEQUAL</var-value>
                  </var>
                  <var>
                    <var-name>fieldValue[1]</var-name>
                    <var-value> </var-value>
                  </var>
                  <var>
                    <var-name>fieldJoin</var-name>
                    <var-value>OR</var-value>
                </var>
            </field>




---
Thanks...
Mick Knutson
---

_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8. 
http://join.msn.com/?page=features/junkmail


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


Re: requiredif question

Posted by David Graham <gr...@yahoo.com>.
--- Mick Knutson <mi...@hotmail.com> wrote:
> I have the following code that does not seem to operate at all.
> 
> I want phone1type to be a required field _if_ the phone1 attribute is
> _not_ 
> ""
> 
>             <field  property="phone1type"
>                     depends="requiredif">
>                 <arg0 key="form.phone1type"/>
>                 <var>
>                     <var-name>field[0]</var-name>
>                     <var-value>phone1</var-value>
>                 </var>
>                 <var>
>                     <var-name>fieldTest[0]</var-name>
>                     <var-value>NOTNULL</var-value>
>                 </var>
>                 <var>
>                     <var-name>field[1]</var-name>
>                     <var-value>phone1</var-value>
>                   </var>
>                   <var>
>                     <var-name>fieldTest[1]</var-name>
>                     <var-value>NOTEQUAL</var-value>
>                   </var>
>                   <var>
>                     <var-name>fieldValue[1]</var-name>
>                     <var-value> </var-value>

You can't define empty values in XML like that because the parser removes
the whitespace.  I'm not quite how to accomplish this though.

David


>                   </var>
>                   <var>
>                     <var-name>fieldJoin</var-name>
>                     <var-value>OR</var-value>
>                 </var>
>             </field>
> 
> 
> 
> 
> ---
> Thanks...
> Mick Knutson
> ---
> 
> _________________________________________________________________
> Tired of spam? Get advanced junk mail protection with MSN 8. 
> http://join.msn.com/?page=features/junkmail
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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


Re: requiredif question

Posted by Kevin Robair <kr...@yahoo.com>.
Just a hunch:

For Struts 1.1RC1 , the varnames should be:

field-test[x]
field-join
etc...

In 1.1RC2, they are

fieldTest[n]
fieldJoin  
etc....

BTW, I am unsure what you mean by:

  "does not seem to operate at all"

Are there any errors or exceptions in the log? If the form validates no
matter what you enter, and there are no errors in the log, then it is
possibly a configuration problem. You could try a simpler validation, in
place of this one just to make sure it is doing something. Then, remove
the NOTNULL check, and see if the NOTEQUAL alone works.

-Kevin

--- Mick Knutson <mi...@hotmail.com> wrote:
> I have the following code that does not seem to operate at all.
> 
> I want phone1type to be a required field _if_ the phone1 attribute is
> _not_ 
> ""
> 
>             <field  property="phone1type"
>                     depends="requiredif">
>                 <arg0 key="form.phone1type"/>
>                 <var>
>                     <var-name>field[0]</var-name>
>                     <var-value>phone1</var-value>
>                 </var>
>                 <var>
>                     <var-name>fieldTest[0]</var-name>
>                     <var-value>NOTNULL</var-value>
>                 </var>
>                 <var>
>                     <var-name>field[1]</var-name>
>                     <var-value>phone1</var-value>
>                   </var>
>                   <var>
>                     <var-name>fieldTest[1]</var-name>
>                     <var-value>NOTEQUAL</var-value>
>                   </var>
>                   <var>
>                     <var-name>fieldValue[1]</var-name>
>                     <var-value> </var-value>
>                   </var>
>                   <var>
>                     <var-name>fieldJoin</var-name>
>                     <var-value>OR</var-value>
>                 </var>
>             </field>
> 
> 
> 
> 
> ---
> Thanks...
> Mick Knutson
> ---
> 
> _________________________________________________________________
> Tired of spam? Get advanced junk mail protection with MSN 8. 
> http://join.msn.com/?page=features/junkmail
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 


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