dcsimg
www.webdeveloper.com
Results 1 to 3 of 3

Thread: Toggle disabled - problems

  1. #1
    Join Date
    Sep 2009
    Posts
    3

    Toggle disabled - problems

    Hi everyone -

    I have a form with oodles of fields...(it's an administrative page for CMS)

    I want to begin the form with the "extra_add" field disabled, but if the client clicks on the checkbox (cb_extraAdd), I would like to enable the "extra_add" field, and disable the "extra". This would need to occur with 3 different checkboxes, each following the above structure (but with different IDs).

    Example:

    <input type="text" id="extra" value="php string here" />

    <input type type="checkbox" id="cb_extraAdd" name="extra" />

    <input type="text" id="extra_add" value=" " />

    I found a javascript toggle on a search, but I can't seem to get it to work.

    Thanks in advance!

  2. #2
    Join Date
    Sep 2009
    Posts
    3
    (and yes, I see the typo above with the double "type" -- that is not in the original code -- where is "edit" on these threads?)

  3. #3
    Join Date
    Sep 2009
    Posts
    3
    Ok, so I figured this out using this:

    <script language="javascript">

    function enableExtra1()
    {
    document.form1.address2.disabled=false;
    }
    </script>

    <input type="checkbox" name="cb_extraAdd id="cb_extraAdd" onclick="enableField()">Click here to enable the element<a/>

    However -- how do I get the field to disable again if someone clicks OFF the checkbox?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles