Skip to content

Commit 3ec88a4

Browse files
authored
fix(form): show validator dropdown before submit button
1 parent 77036a9 commit 3ec88a4

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

inc/form.class.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,15 +1024,6 @@ public function displayUserForm() : void {
10241024
]);
10251025
// Delete saved answers if any
10261026
unset($_SESSION['formcreator']['data']);
1027-
1028-
// Show validator selector
1029-
if (Plugin::isPluginActive('advform')) {
1030-
echo PluginAdvformForm_Validator::dropdownValidator($this);
1031-
} else {
1032-
if ($this->validationRequired()) {
1033-
echo PluginFormcreatorForm_Validator::dropdownValidator($this);
1034-
}
1035-
}
10361027
}
10371028

10381029
/**

inc/form_validator.class.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,14 @@ public static function dropdownValidatorGroup(): string {
671671
*
672672
*/
673673
public static function dropdownValidator(PluginFormcreatorForm $form): string {
674+
if (Plugin::isPluginActive('advform')) {
675+
return PluginAdvformForm_Validator::dropdownValidator($form);
676+
}
677+
678+
if (!$form->validationRequired()) {
679+
return '';
680+
}
681+
674682
$validators = [];
675683
$formValidator = new PluginFormcreatorForm_Validator();
676684
// Validators of either user type or group type

templates/pages/userform.html.twig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@
122122
}
123123
)
124124
</script>
125+
126+
{{ call('PluginFormcreatorForm_Validator::dropdownValidator', [
127+
item
128+
])|raw }}
129+
125130
<div class="center">
126131
{{ call('Html::submit', [
127132
__('Send'),

0 commit comments

Comments
 (0)