MDL-78795 core_form: Fix repeated elements JS problem

Co-authored-by: Stefan Hanauska <[email protected]>
This commit is contained in:
Philipp Memmel
2023-09-03 14:12:30 +02:00
co-authored by Stefan Hanauska
parent 206c3a66e7
commit c9398e27f2
+7
View File
@@ -77,6 +77,13 @@ class dynamic_form extends external_api {
// Render actual form.
if ($form->no_submit_button_pressed()) {
// If form has not been submitted, we have to recreate the form for being able to properly handle non-submit action
// like "repeat elements" to include additional JS.
/** @var \core_form\dynamic_form $form */
$form = new $formclass(null, null, 'post', '', [], true, $formdata, true);
$form->set_data_for_dynamic_submission();
}
// Hack alert: Forcing bootstrap_renderer to initiate moodle page.
$OUTPUT->header();