Mike Eghtebas
asked on
OnCheckedChanged event... javascript
Upon checking chkEmailUpdates below:
<asp:CheckBox ID="chkSpecial" runat="server" Text="Email me updates" OnCheckedChanged="fncEnabl eEmailBox( Cheched)" />
the text box below (txtAddress, already disabled)
<asp:TextBox ID="txtAddress" runat="server" Enabled="False"></asp:Text Box>
is expected to fire fncEnableEmailBox() with an argument true or false to enable or disable txtAddress and also activate or deactivate its validation (unless validation is ignore when a control is disabled)?
Question: How is this done in javascript?
I suppose this could be done in vb itself without using javascript? But I suppose, javascript will be better because it doesn't involve a postback and updating the disable/disable status of txtAddress in page onload event (using session variables). I appreciate some comments on this point.
Thank you
<asp:CheckBox ID="chkSpecial" runat="server" Text="Email me updates" OnCheckedChanged="fncEnabl
the text box below (txtAddress, already disabled)
<asp:TextBox ID="txtAddress" runat="server" Enabled="False"></asp:Text
is expected to fire fncEnableEmailBox() with an argument true or false to enable or disable txtAddress and also activate or deactivate its validation (unless validation is ignore when a control is disabled)?
Question: How is this done in javascript?
I suppose this could be done in vb itself without using javascript? But I suppose, javascript will be better because it doesn't involve a postback and updating the disable/disable status of txtAddress in page onload event (using session variables). I appreciate some comments on this point.
Thank you
ASKER
Hi jyparask,
If this is what you mean:
Then how to pass the value of bolCheched argument in:
OnCheckedChanged="fnEnable EmailBox(C heched)"If so, I have the following error:
Compiler Error Message: BC30456: 'fnEnableEmailBox' is not a member of 'ASP.addcontact_aspx'.
Thanks
If this is what you mean:
<Script>
Function fnEnableEmailBox(bolCheched As Boolean) {
document.getElementById('txtAddress').disabled = bolCheched ;
' also this needs to be handled as well
'if (bolCheched == false) {
' txtAddress ="";
'}
}
</Script>
Then how to pass the value of bolCheched argument in:
OnCheckedChanged="fnEnable
Compiler Error Message: BC30456: 'fnEnableEmailBox' is not a member of 'ASP.addcontact_aspx'.
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you.
Try the following:
Open in new window
Giannis