Hello,
I'm using Struts and EJB for my application. I've one checkbox field and three fields for username, password and confirm password (two textboxes and one password fields).
My Scenario is:
Initially, i've entered all the values in the text-boxes and password field
without checking the check-box and the submit button has been pressed and the page has been forward to the same page and the entered values are displayed again.
Now, when i
check the check-box, three fields has been made disabled (Pls. refer the code below) and again click on Submit button, the values in the text-boxes and password fields are not getting appeared in the fields.
Here is the Struts Code:
<html:checkbox name="form1" property="aocUser" value="true" styleClass="radiocheck" onclick="javascript:disableCustomerUserPassword();" /> AOC USER
<c:choose>
<c:when test="${form1.aocUser=='true'}">
<td width="200" height="26"><html:text name="form1" property="customerUserName" maxlength="100" tabindex="34" styleClass="formfield" disabled="true" /></td>
</c:when>
<c:otherwise>
<td width="200" height="26"><html:text name="form1" property="customerUserName" maxlength="100" tabindex="34" styleClass="formfield" /></td>
</c:otherwise>
</c:choose>
Here is the Javascipt Function:
function disableCustomerUserPassword() {
if(document.getElementById("aocUser").checked)
{
document.form1.customerUserName.disabled=true;
document.form1.customerUserPassword.disabled=true;
document.form1.confirmCustomerUserPassword.disabled=true;
}
else
{
document.form1.customerUserName.disabled=false;
document.form1.customerUserPassword.disabled=false;
document.form1.confirmCustomerUserPassword.disabled=false;
}
}