struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thiago Tonelli Bartolomei <thi...@icaro.com.br>
Subject Validating an integer and a double problem
Date Fri, 25 Jul 2003 15:05:47 GMT
Hi,
    I'm trying to use the validator on two fields of my form. One field 
is an integer and the other is a double. They are both required. The 
problem is that only the integer and required validations are working. 
The double validation is not called from the generated 
dynamicJavascript. The question is: Why the generated javascript does 
not call something like :

    return validateRequired(form) && validateInteger(form) && validateDouble(form);


I thank you all in advance :)

	Thiago Bartolomei

Details:

----------------
validation.xml :
----------------
<form-validation>
    <global>
    </global>
    <formset>
       <form name="myForm">
          <field property="doubleField" depends="required,double">
              <arg0 key="label.doubleField" />
          </field>
          <field property="integerField" depends="required,integer">
              <arg0 key="label.integerField" />
          </field>
       </form>
    </formset>
</form-validation>

-----------------
on the jsp file :
-----------------
o
<%-- initialize the validation javascripts --%>
<html:javascript formName="myForm" />

and

<html:form action="myAction.do" onsubmit="validateMyForm(this)">


----------------------------
on the generated html file :
----------------------------

<script type="text/javascript" language="Javascript1.1"> 

<!-- Begin 

     var bCancel = false; 

    function validateMyForm(form) {                                                      
            
        if (bCancel) 
      return true; 
        else 
       return validateRequired(form) && validateInteger(form); 
   } 

    function required () { 
     this.aa = new Array("doubleField", "My Required Description", new Function ("varName",
" return this[varName];"));
     this.ab = new Array("integerField", "My Required Description", new Function ("varName",
" return this[varName];"));
    } 

    function IntegerValidations () { 
     this.aa = new Array("integerField", "My Integer Description", new Function ("varName",
" return this[varName];"));
    } 


-- 
--
Thiago Tonelli Bartolomei
Icaro Technologies - www.icaro.com.br
Phone: +55-19-3237-7878 x.249




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


Mime
View raw message