Web Analytics Made Easy -
StatCounter Hidden fields - CodingForum

Announcement

Collapse
No announcement yet.

Hidden fields

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Hidden fields

    I'm trying to come up with a way to hide a field depending on what the user clicks.

    I have a check box that is called denied, I also have a select box called denied_by,and a text box called denied_date. I would like the select box(denied_by) and the text box(denied_date) hidden until the user clicks on the check box.

    Does anybody know if this is doable and if so how do I do it. I can not figure it out

    Thanks for any help.

  • #2
    Try using style display to hide/show the form elements.

    eg:
    Code:
    <html>
    <head>
    <script type="text/javascript">
    function hideShow(id){
    var div = document.getElementById(id);
    div.style.display = (div.style.display=='none') ? 'block':'none';
    return false;
    }
    </script>
    </HEAD>
    
    <BODY>
    <form>
    Deny <input type="checkbox" onclick="hideShow('Div1')">
    <div id ="Div1" style="display:none;">Place Hidden Form Elements Here</div>
    </form>
    .....Willy

    Comment

    Working...
    X