Click here to Skip to main content
16,004,678 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to enable or disable form object using flag as parameter to function.
Posted
Comments
Rajesh Kariyavula 5-Jun-12 6:45am    
I suppose that you are thinking of a common function that will be used to enable/ disable any control in your form using JavaScript, is that correct?

If yes what type of controls do you have in your page.
swapnil66 5-Jun-12 8:40am    
Textbox ,textarea ,checkbox,radiobutton,buttons.

i dont want to use direct "Disable=true/false".i want to use a flag to enable or disable control .

Thanks

1 solution

Try this

JavaScript
function EnableDisableControls(flag) {
    var hdnChkBox = document.getElementById("hdnChkBox").value;
    var chkCheckBox = document.getElementById(hdnChkBox);
    var hdnTextBox = document.getElementById("hdnTextBox").value;
    var txtTextBox = document.getElementById(hdnTextBox);
            
    chkCheckBox.disabled = flag;
    txtTextBox.disabled = flag;
          
}


Hope this helps.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900