Sorry I've got and error...change

this line

<var-value>(act == 'alta')</var-value>

with this

<var-value>(act == 'insert')</var-value>

Thanks

----- Original Message ----- 
From: "Ruben Orta Magan" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Tuesday, October 28, 2003 2:02 PM
Subject: validwhen kills me!


Hello.....I've got a problem with validwhen. I've got a form with two
buttons.....one makes and insert in the database, and the other makes a
search....I want to make a validation only when the insert button is pushed
and i don't know if i understand correctly how validwhen works.

I've got this form....

<html:form action="/icytReviAction" onsubmit="return
validateIcytReviForm(this)">

<html:text property="name"/>
<html:text property="email"/>

<html:hidden property="act"/>

<html:submit value="alta"
onclick="javascript:document.forms[0].act.value='insert';"/>
<html:submit value="alta"
onclick="javascript:document.forms[0].act.value='search';"/>

</html:form>
The hidden input called act that is filled with the word "search" or
"insert", the value depends of the button you push.

I want to set name as a required field and email has a required, email mask
field.

If i put this validation don't run :\

            <field
                property="name"
                depends="validwhen">
                <arg0 key="icytReviForm.name.displayname"/>
                <var>
                    <var-name>test</var-name>
                    <var-value>(act == 'alta')</var-value>
                </var>
            </field>

            <field
                property="email"
                depends="validwhen,email">
                <arg0 key="icytReviForm.name.displayname"/>
                <msg name="email" key="errors.icytReviForm.formatoCOZ"/>
                <var>
                    <var-name>test</var-name>
                    <var-value>(act == 'alta')</var-value>
                </var>
            </field>

Some one knows how to validate correctly?? Someone use validwhen and it's
validate correctly?

Thanks in advance


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to