Help with Javascript in a form

  • Started
  • Last post
  • 1 Response
  • hellrod

    I am building a form that has 5 radio buttons of options but want the last one to enable two text fields. I've been using a simple javascript to enable text fields with a single checkbox but since it's with several radio input options choosing another option doesn't disable the text input boxes until it's selected again. I kinda see why it's doing it but don't know to fix it.

    Here's a link to the form...
    http://www.creativefusion.com/fo…
    and it's the first two input areas on the form.

    Also, here's the javascript I am using to enable/disable on other parts of the form.

    <script>
    function custom_ad_disable_enable(){
    if (document.all || document.getElementById){
    if (document.adsubmit.adsize_width...
    document.adsubmit.adsize_width.d...
    else
    document.adsubmit.adsize_width.d...
    }
    if (document.all || document.getElementById){
    if (document.adsubmit.adsize_height...
    document.adsubmit.adsize_height...
    else
    document.adsubmit.adsize_height...
    }
    }
    </script>
    Any help would be greatly appreciated.

  • acescence0

    first, you have to make all of the radio buttons trigger the javascript function, not just the last.

    here's the updated javascript: http://pastebin.com/mRvyvtaW

    it seems you're using jquery already though, this could be rewritten with jquery to be much more succinct, but meh, whatever.

    • Thanks! You sir are brilliant! And yes jQuery is the next step.hellrod