You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Jinli Cao <Ji...@exigenservices.com> on 2011/03/31 06:37:36 UTC

[validator] How to do when I have a issue that there are some inputs at my form in JSP, they are displayed or not is depened on a dropdown list. In this case, If I config all input properties in my validation.xml as one form, the component will check all.

But I don't want to process like that.
Please look at my one part of javascript  in my JSP.


<script language="javascript" type="text/javascript">
      function changeDiv(){
            var   name   =document.getElementById("paymentType").selectedIndex;
            var cc=document.getElementById("creditCardDiv");
            var eft=document.getElementById("eftDiv");
            if(name=="0"){
                  document.getElementById("creditCardDiv").style.display="block";
                  document.getElementById("eftDiv").style.display="none";
             }
            else if(name=="1"){
                  document.getElementById("creditCardDiv").style.display="none";
                document.getElementById("eftDiv").style.display="block";
             }
}
</script>
<form:select path="paymentMethod" onchange="changeDiv()" id="paymentType" >
                                                                                   <form:options items="${paymentMethods}" />
</form:select>


There two DIVs in my page(creditCardDiv, eftDiv), It is good if when choose CreditCardDiv, the validation to efvDiv disabled.
Please help me.


Regards.
Jinli.