Skip to content

Commit

Permalink
MDL-78795 core_form: Fix repeated elements JS problem
Browse files Browse the repository at this point in the history
Co-authored-by: Stefan Hanauska <[email protected]>
  • Loading branch information
PhMemmel and sh-csg committed Sep 3, 2023
1 parent 206c3a6 commit c9398e2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/form/classes/external/dynamic_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ public static function execute(string $formclass, string $formdatastr): array {

// 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();

Expand Down

0 comments on commit c9398e2

Please sign in to comment.