Hello folks,

I have a content form. It has a textbox and a checkbox control (both are asp server controls and not HTML).

When the user checks on the checkbox control, the textbox control has to become invisible. If unchecked the textbox control has to become visible. The following code works on a regular webform (meaning not as a content form). toggleVisibility is the function name that does the actual work. I am guessing I am not passing the textbox control ID properly to toggleVisibility function. Can someone guide me please?

Following is the code:
<asp:TextBox ID="TextBoxPeriod" 
        runat="server"  Width="97px"></asp:TextBox>

<asp:CheckBox ID="CheckBoxFromArchive"  runat="server" Visible="true" 
           Onclick="toggleVisibility('<%=TextBoxPeriod.ClientID %>');"  />

 function toggleVisibility(controlId) {
        var control = document.getElementById(controlId);

        if (control.style.visibility == "visible" || control.style.visibility == "") {
            control.style.visibility = "hidden";

        else {
            control.style.visibility = "visible";

Thanks much