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

Question

Question

Is it possible to take values entered into a Forms table and use them as a drop down list later in the form?

asked on December 12, 2016

I have a client who's building out a form that is capturing household information.  They have a table that is asking the user to enter in the composition of the household.  One of the table fields is the name of the household member.

 

Later in the form there is a table asking for Employment information for each member of the family.  They client would like to have a Family Member drop down list in the table that is populated with the names entered into the previous table.

Is this possible?  If so how would they go about this?

0 0

Replies

replied on December 12, 2016

You would need to use javascript to do this. Here is an example of how you could do it:

$(document).ready(function() {
  $(".testTable").on("change", "input",function() {
    var $el = $(".nameDrop select");
    $el.empty();
    var key = 0;
    $(".testTable .name input").each(function() {
      var name = $(this).val();
      console.log("naem: " + name);
      $el.append($("<option></option>").attr("value", key ).text(name));
      key++;
    });


  });
});

Where ".testTable" is the class of the table, ".name" is the class given to the table column of interest, and ".nameDrop" is the class of the dropdown menu of interest

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

Sign in to reply to this post.