Invoking a function from radio button state change

 5 Replies
 0 Subscribed to this topic
 12 Subscribed to this forum
Sort:
Author
Messages
Joe O'Toole
Veteran Member
Posts: 314
Veteran Member
    I've tried adding the onclick or onchange options to the radio button FLD definition - IE: onclick="test_function()", but it seems to have no effect. has anyone done this or is there a better way? Thanks.
    ShawnV
    Advanced Member
    Posts: 37
    Advanced Member
      If you are using Design Studio, Lawson will automatically call the RADIO_OnClick(id,row) function. You can then capture which button (id) is selected & you can then call the necessary function from there.
      function RADIO_OnClick(id, row)
      {
      if (id = "val1")
      {
      yourfunction();
      }
      }
      ShawnV
      Advanced Member
      Posts: 37
      Advanced Member
        Joe - My bad. I forgot to include some additional code. The "id" that comes back is only the name of the radio button group(the same for all your options). You will then need to get the actual form value to identify which option was selected:
        function RADIO_OnClick(id, row)
        {
        if (id = "RadioBtns")
        {
        var vRadioOption = lawForm.getFormValue(id);
        if (vRadioOption = "Val1")
        yourfunction();
        }
        }
        ShawnV
        Advanced Member
        Posts: 37
        Advanced Member
          I could have sworn I replied to this message yesterday, anyway.
          If you are using Design Studio, for every cilck on a Radio Button, Lawson calls the function RADIO_OnClick(id,row). Once that function is called, you will then need to get the form value to determine which radio button was actually selected. Once you know that, you can then call your own function as necessary. Below is some sample code:
          function RADIO_OnClick(id, row)
          {
          if (id == "radio1")
          {
          var vRadioOption = lawForm.getFormValue(id);
          if (vRadioOption == "FirstOption")
          yourfunction()
          }
          }
          Joe O'Toole
          Veteran Member
          Posts: 314
          Veteran Member
            Thanks, I'll try this out today and let you know.
            Joe O'Toole
            Veteran Member
            Posts: 314
            Veteran Member
              This worked. Thanks!