struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "A. Lotfi" <majidna...@yahoo.com>
Subject disable struts button when javascript function is doing soemthing
Date Tue, 07 Jul 2009 20:41:22 GMT
Hi,
 
I have a jsp page :
 
 
<html:html>
 
.....
function validateForm(validationCSDVal,validationURDVal){
               dataChanged(); 
           
            
            
            if(document.budgetSummary.budgetStatusCode.selectedIndex == 1){
                    if(document.budgetSummary.finalVersionFlag.checked
== false){
                    alert("<bean:message bundle="budget" key="budgetSummary.selectFinalVersion"
/>");
                    document.budgetSummary.budgetStatusCode.selectedIndex
= 0;
                    return false;
                    }
                 }//End outer if
                 // Added for Cost Sharing Distribution Validation - start
                 if(document.budgetSummary.budgetStatusCode.selectedIndex
== 1){
                        var validateCSDMsg = '<%=validationMsg%>';
                        var validateURDMsg = '<%=validationURDMsg%>';
                        if(validationCSDVal == 'force' || validationURDVal
== 'force'){
                            if(validateCSDMsg == 'amtUnequal'){
                                alert("<bean:message bundle="budget"
key="costSharingDistribution.error.UnequalAmts1"/>\n<bean:message bundle="budget" key="costSharingDistribution.error.UnequalAmts2"/>");
                            }else if(validateCSDMsg == 'noCSD'){
                               alert("<bean:message bundle="budget"
key="costSharingDistribution.error.CSDforVersion"/>");
                            }
                            if(validateURDMsg == 'amtUnequal'){
                                alert("<bean:message bundle="budget"
key="underRecoveryDistribution.alertMessage1"/>\n<bean:message bundle="budget" key="underRecoveryDistribution.alertMessage2"/>");
                            }else if(validateURDMsg == 'noUnderRec'){
                               alert("<bean:message bundle="budget"
key="underRecoveryDistribution.error.URDforVersion"/>");
                            }
                            document.budgetSummary.budgetStatusCode.selectedIndex
= 0;
                            return false;
                        }
                       /* }else if(validationURDVal == 'force'){
                            if(validateURDMsg == 'amtUnequal'){
                                alert("<%--bean:message
bundle="budget" key="underRecoveryDistribution.alertMessage1"/>\n<bean:message bundle="budget"
key="underRecoveryDistribution.alertMessage2"/--%>");
                            }else if(validateURDMsg == 'noUnderRec'){
                               alert("<%--bean:message bundle="budget"
key="underRecoveryDistribution.error.URDforVersion"/--%>");
                            }
                            document.budgetSummary.budgetStatusCode.selectedIndex
= 0;
                            return false;
                        }*/
                        /*else if(validationCSDVal == 'notForce'){
                            return true;
                        }else if(validationURDVal == 'notForce'){
                            return true;
                        }*/
                         
                        validateBudget(<%=versionNumber%>);
                        
                 }
              
}
 
....
<html:form action="/budgetSummary.do"> 
 
<td width='40%' align="left" >
                                    <% // modified for
Cost Sharing Distribution Validation - 
                                    String validateForm
= "javascript: validateForm('"+forceCSDValidation+"','"+forceUnderRecValidation+"');";%>
                                    <html:select property="budgetStatusCode"
styleClass="textbox-long" disabled="<%=readOnly%>" onchange="<%=validateForm%>">
                                        <html:options
collection="budgetStatus"  property="code" labelProperty="description"  />
                                    </html:select>
                                </td>
 
 
<html:submit property="Save" value="Save"  styleClass="clbutton" "/>
 
.....
</html:html>
 
 
How to disbale the save button when the javascript function validateForm is doing someting
and enable it back after the function is done ?
 
 
thanks


      
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message