Trigger checkbox when combo box is changed

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jason McDonald

    #1

    Trigger checkbox when combo box is changed

    I have a PDF form that has a combo box "no_wireless_mi cs" with the
    values "1" "2" and " " where " " is the default. I need a JavaScript
    that will cause the check box "wireless_m ics" to be checked
    (value=true) when the combo box value is "1" or "2"

    I ama JavaScript newbie and I'm having quite a time figuring this out.
    Thank you for your time and attention.
  • Vjekoslav Begovic

    #2
    Re: Trigger checkbox when combo box is changed

    "Jason McDonald" <jmcdonald@nyc. rr.com> wrote in message
    news:5cfb4113.0 309150717.5d8aa ef9@posting.goo gle.com...[color=blue]
    > I have a PDF form that has a combo box "no_wireless_mi cs" with the
    > values "1" "2" and " " where " " is the default. I need a JavaScript
    > that will cause the check box "wireless_m ics" to be checked
    > (value=true) when the combo box value is "1" or "2"
    >
    > I ama JavaScript newbie and I'm having quite a time figuring this out.
    > Thank you for your time and attention.[/color]

    For example:

    <html>
    <head>
    <script type="text/javascript">
    function miscOnChange(ob j){
    if ((obj.value == 1) || (obj.value == 2)){
    document.getEle mentById("wirel esmisc").checke d=true;
    }
    else{
    document.getEle mentById("wirel esmisc").checke d=false;
    }
    }
    </script>
    </head>

    <body>
    <input type="checkbox" id="wirelesmisc ">Wireless
    <select id="misc" onchange="miscO nChange(this)">
    <option value=""></option>
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>
    </select>
    </body>
    </html>

    HTH

    Vjekoslav


    Comment

    • Egbert Beuker

      #3
      Re: Trigger checkbox when combo box is changed

      i think this should work:

      <!-- Begin of sample -->

      <script language="javas cript">
      function sel_onchange()
      {
      document.all.wi reless_mics.che cked = true;
      }
      </script>

      <select id="no_wireless _mics" name="no_wirele ss_mics"
      onchange="sel_o nchange()">
      [your options go here]
      </select>

      <input type="checkbox" id="wireless_mi cs" name="wireless_ mics">

      <!-- End of sample -->

      "Jason McDonald" <jmcdonald@nyc. rr.com> wrote in message
      news:5cfb4113.0 309150717.5d8aa ef9@posting.goo gle.com...[color=blue]
      > I have a PDF form that has a combo box "no_wireless_mi cs" with the
      > values "1" "2" and " " where " " is the default. I need a JavaScript
      > that will cause the check box "wireless_m ics" to be checked
      > (value=true) when the combo box value is "1" or "2"
      >
      > I ama JavaScript newbie and I'm having quite a time figuring this out.
      > Thank you for your time and attention.[/color]


      Comment

      Working...