Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: Disable

  1. #1
    New Coder
    Join Date
    Apr 2005
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Disable

    Code:
    <form action="" method="post">
    <input name="popup_countdown_enable" type="radio" value="1">Yes<br>
    <input name="popup_countdown_enable" type="radio" value="0">No
    <select size="1" name="startyear">
      <option value="2006">2006</option>
    </select>
    <textarea name="file" rows=5 cols=20 wrap="off"></textarea>
    </form>
    If popup_countdown_enable = 1, startyear and file are enabled. If popup_countdown_enable = 0, startyear and file are disabled.

    Thanx in advance !

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    one solution could be:
    PHP Code:
    <input name="popup_countdown_enable" type="radio" value="1" onclick="document.getElementById('mydiv').style.display='block'">Yes<br>
    <
    input name="popup_countdown_enable" type="radio" value="0" onclick="document.getElementById('mydiv').style.display='none'">No
    <div id="mydiv" style="display:none">
    <
    select size="1" name="startyear">
      <
    option value="2006">2006</option>
    </
    select>
    <
    textarea name="file" rows=5 cols=20 wrap="off"></textarea>
    </
    div
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    New Coder
    Join Date
    Apr 2005
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sorry, maybe I wasn't clear enough. I Ment disabling the field himself. Same effect as

    Code:
    <textarea name="file" rows=5 cols=20 wrap="off" disabled></textarea>

  • #4
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    displaying none/block has the same effect, I mean the form's elements' values are not to be sent onsubmit

    anyway, if you want to use disable:
    PHP Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"  "http://www.w3.org/TR/html4/loose.dtd">
    <
    html>
    <
    head>
    <
    title>Untitled Document</title>
    <
    meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <
    meta http-equiv="Content-Style-Type" content="text/css">
    <
    meta http-equiv="Content-Script-Type" content="text/javascript">
    <
    script type="text/javascript">
    function 
    dis(f,b){
    f.startyear.disabled=b;
    f.file.disabled=b;
    }
    </script>

    </head>
    <body>
    <form action="" method="post">
    <input name="popup_countdown_enable" type="radio" value="1" onclick="dis(this.form,Boolean(Number(this.value)))">Yes<br>
    <input name="popup_countdown_enable" type="radio" value="0" onclick="dis(this.form,Boolean(Number(this.value)))">No
    <select size="1" name="startyear" disabled="true">
      <option value="2006">2006</option>
    </select>
    <textarea name="file" rows=5 cols=20 wrap="off" disabled="true"></textarea>
    </form>
    </body>
    </html> 
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •