You are viewing limited content. For full access, please sign in.

Question

Question

set radio button in table from external radio button

asked on November 29, 2022

I have a radio button (not in a table) on a form. It is hidden, but once triggered looks like this.

I would like to fill the following radio button in a table if either selection is chosen from the external radio button. If nothing is chosen, then the user would manually fill the field in the table.

I've found posts similar, but not quite what I need. I am not great a javascript, which I think is the only way to do this. Please help.

 

0 0

Replies

replied on January 11, 2023

Hi Mary,

Here is an example:

First configure radio button out table with class "radio1", radio button in table with class "radio2" and table with class "radioTable" like this:

Then set custom script:

$(document).ready(function(){
  var radioChoice = '';
  $('.radio1 input').click(function(){
    radioChoice = $(this).val();
    updateRadioInTable();
  });
  function updateRadioInTable() {
    $('.radio2 input').each(function() {
      if ($(this).val() == radioChoice) {
        $(this).click();
      }
    });
  }
  $('.radioTable .cf-table-add-row').click(function(){
    updateRadioInTable();
  });
});

 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.