Hi All.
I have a problem & would appreciate help to resolve it.
My parent application form has a child details table with a Medical Conditions Yes/No drop down.
My aim is to have the names of students with Medical Conditions = "Yes" populated into a 2nd table later in the form that will be used to drill into specific Medical conditions for each child.
If my code was working, "Yes" values for child 1 & 3 below would copy into the "Children with Medical conditions" table below;
This is the code I used;
function updateTable2() { // Clear Table 2 $('.table2 tbody').empty(); // Loop through Table 1 rows $('.table1 tbody tr').each(function () { var includeVal = $(this).find('.includeField input').val(); var nameVal = $(this).find('.nameField input').val(); if (includeVal === "Yes") { // Add row to Table 2 var newRow = $('<tr><td><input type="text" class="nameField2" value="' + nameVal + '" /></td></tr>'); $('.table2 tbody').append(newRow); } }); } // Run on form load and when Table 1 changes $(document).ready(function () { updateTable2(); // Re-run when any input in Table 1 changes $('.table1').on('change', 'input', function () { updateTable2(); }); });
To minimise errors I added the default CSS classes to each of the 5 items as seen here;
Table 2 has these settings;
The destination table 2 Name field is seen as below;
Any assistance to help get this working would be greatly appreciated!
Thanks.
Regards, Steve