I am using Forms 12 with Classic Designer.
I would like to have the Date Column in a row of a table or collection auto fill with the date value set in a field OUTSIDE the table and collection resulting in each new row defaulting to the value in the Date field outside.
Date field outside collection / table: Called Today with css Today as well
Table css: MyLaborTable
Date field inside table: LaborDate
I tried using the Default Value option and pointing it to Today. Nothing fills.
I tried Javascript to work with a table. This too does not fill in the date value in the table. I tried using a collection and altering the javascript, but that too did not produce the intended results. Suggestions?
// Store the selected date from the Today field $(document).on('change', '.Today', function () { window.todaySelected = $(this).val(); }); // Watch for new rows added to the MyLaborTable $(document).on('table-row-added', function (event) { var $newRow = $(event.target); // Make sure it's part of the right table if ($newRow.closest('.MyLaborTable').length > 0 && window.todaySelected) { var $laborDate = $newRow.find('.LaborDate'); if ($laborDate.length > 0) { $laborDate.val(window.todaySelected); $laborDate.trigger('change'); // Trigger field rules if needed } } });