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

Reply via email to