diff --git a/resources/views/form/rapport-team4/1791539482-b06c2f9a-fe45-4b16-843a-224f07ed0d7b.blade.php b/resources/views/form/rapport-team4/1791539482-b06c2f9a-fe45-4b16-843a-224f07ed0d7b.blade.php index 192f8061..75307b21 100644 --- a/resources/views/form/rapport-team4/1791539482-b06c2f9a-fe45-4b16-843a-224f07ed0d7b.blade.php +++ b/resources/views/form/rapport-team4/1791539482-b06c2f9a-fe45-4b16-843a-224f07ed0d7b.blade.php @@ -265,6 +265,7 @@ $("[id^='field-contact_id']").each(function() { var select = $(this); // Clear previous options + var existingVal = select.val(); select.html(''); // Add a default 'Select' option select.append( @@ -293,6 +294,11 @@ // - result: field-msl_code_1, field-speciality_1, etc. // Remove any old event handlers first to prevent duplicate bindings + + if (existingVal) { + select.val(existingVal); + } + select.off('change').on('change', function () { var selected = $(this).find(':selected'); @@ -316,6 +322,10 @@ enforceUniqueDoctorSelections(); }); + if (existingVal) { + select.trigger('change'); + } + // Ensure unique selection is enforced after initial render enforceUniqueDoctorSelections(); });