468 Commits

Author SHA1 Message Date
Marina Glancy
ef1759da74 MDL-80820 various: fix incorrect phpdocs 2024-04-08 10:13:10 +01:00
sam marshall
79038ab3a3 MDL-81066 core_form: Validate form fields on submit only 2024-03-18 13:25:39 +00:00
Eloy Lafuente (stronk7)
29a541724f
MDL-65292 style: Fix all the function declaration ordering
This has been generated running the following Sniff,
part of the Moodle's CodeSniffer standard:
- PSR2.Methods.MethodDeclaration

It just ensures all the function declarations have
the correct order for:
- abstract and final.
- visibility (public, protected, private).
- static.

So, all the lines modified by this commit are function declarations
and the only changes are in the positions of those keywords.
2024-02-28 23:47:47 +01:00
Eloy Lafuente (stronk7)
ba1f804ffa
MDL-65292 style: Fix all function declarations white space
This has been generated running the following Sniffs, all
them part of the Moodle's CodeSniffer standard:
- PSR12.Functions.ReturnTypeDeclaration
- PSR12.Functions.NullableTypeDeclaration
- moodle.Methods.MethodDeclarationSpacing
- Squiz.Whitespace.ScopeKeywordSpacing

All them are, exclusively, about correct spacing, so the changes
are, all them, only white space changes.

Only exceptions to the above are 3 changes what were setting the
return type in a new line, and, when that happens, the closing
parenthesis (bracket) has to go to the same line than the colon.
2024-02-28 23:33:26 +01:00
Ferran Recio
3344354641 MDL-79985 forms: add choicedropdown form element
The new quick form field uses a choice list to display a dropdown
component inside a form. Apart from que quick form code, the patch also
include a small improvement to the choicelist class to disable empty
values. This small patch is needed because the quickform field won't
allow empty values.
2023-12-19 09:43:35 +01:00
Amaia Anabitarte
0122c2c3e7 MDL-78527 forms: New parentclass attribute to wrapper element only 2023-09-12 09:59:36 +02:00
Sara Arjona
b6715a7dda
MDL-79102 forms: Add uniqueid var to avoid duplicated ids
A new static variable, $uniqueid, has been introduced to the
moodleform class. This enhancement allows for the simultaneous
presence of multiple forms with distinct IDs for action buttons
on a single page, thereby mitigating the accessibility concern
associated with duplicated IDs.
2023-08-28 13:30:39 +02:00
Amaia Anabitarte
36b865b3d9 MDL-78746 formslib: add variables to addHelpButton()
addHelpButton() function should allow to get variables to pass to get_string
to improve help button text.
2023-08-11 11:13:29 +02:00
Amaia Anabitarte
290e6f4c6f MDL-78288 core_course: Adding filter_shown_headers option to forms 2023-07-12 14:22:56 +02:00
Ilya Tregubov
21ab60b30b
MDL-78617 formslib: Fix element with no name going to sticky footer. 2023-06-30 10:03:37 +08:00
Meirza
97ff68fd6b MDL-78159 lib: Added missing properties for core libraries
In PHP 8.2 and later, setting a value to an undeclared class property is
deprecated and emits a deprecation notice.
So we need to add missing class properties that still need to be declared.
2023-06-21 15:39:53 +07:00
Ilya Tregubov
4838f8e916
MDL-77635 formslib: Allow using a sticky footer in QuickForms 2023-06-08 11:05:46 +08:00
Marina Glancy
8fc1486d36 MDL-77164 various: fix incorrect phpdocs 2023-04-13 11:35:06 +01:00
Paul Holden
16747048f3 MDL-77081 forms: PHP8.1 compatibility for group/textarea elements.
See related changes in b0a83aa7, we can no longer pass null values
to some string related methods.
2023-01-31 10:51:24 +00:00
Marina Glancy
b0a83aa7bd MDL-76362 various: Avoid passing nulls to functions that don't allow nulls
PHP 8.1 is more strict on the parameter type. Functions such as trim(), strlen(), str_replace(), etc
show notice when null is passed as an argument
2023-01-23 09:15:54 +08:00
Sujith Haridasan
73d604369d MDL-71062 core: Step 1 deprecation of print_error function 2022-07-13 08:20:54 +05:30
Bas Brands
2faf5e8e48 MDL-72737 theme_boost: update for section header styles 2022-03-01 12:01:59 +01:00
PraiseSatan
ef9ffcd16d MDL-69496 form: Check if element has attributes
Checks if a form element has attributes before
trying to get the default value. This fixes
an error when trying to get the default value
for a frozen group which does not have the
attributes array.
2021-11-15 09:38:20 +11:00
Andrew Nicols
530322e2ce MDL-69918 core: Update uses of legacy form change checker 2021-08-10 23:54:01 +08:00
Andrew Nicols
1a9d53d831 MDL-70990 core_form: Replace FORM_ERROR event
The legacy M.core.event.FORM_ERROR event has been replaced with a new
core_form/events::formError native DOM event.

The new event can be listened to at any point in the DOM using the
following syntax:

```
import {eventTypes} from 'core_form/events';

document.addEventListener(eventTypes.formError, handler);
```

A backward-compatabibility layer is included to ensure that any legacy
YUI event listener is still called with the same arguments.

This legacy bridges will be removed after Moodle 4.3.
2021-05-26 10:47:17 +08:00
Andrew Nicols
acd9d9823b MDL-70990 core_form: Replace FORM_SUBMIT_AJAX event
The legacy M.core.event.FORM_SUBMIT_AJAX ecent has been replaced with a
new core_form/events::formSubmittedByJavascript native DOM event.

The new event can be listened to at any point in the DOM using the
following syntax:

```
import {eventTypes} from 'core_form/events';

document.addEventListener(eventTypes.formSubmittedByJavascript, handler);
```

A backward-compatabibility layer is included to ensure that any
legacy YUI event triggered on a form is still respected and the new
native event is also fired.

A similar handler is also included to ensure that any legacy YUI event
listener is still called with the same arguments.

These legacy bridges will be removed after Moodle 4.3.
2021-05-26 10:46:49 +08:00
Marina Glancy
c79e72085b MDL-70919 core_form: non-static method can not be called statically 2021-03-18 12:15:49 +01:00
Andrew Nicols
972e6ffe47 MDL-70987 core_form: Use correct id for elementid during validation
The id of the formid was being passed instead of the elementid.
2021-02-24 09:05:38 +08:00
Marina Glancy
3045005295 MDL-64554 core_form: Move strings to outputrequirements.lib 2021-02-17 18:07:01 +01:00
Marina Glancy
72be49c473 MDL-64554 core_form: new API for modal forms 2021-02-17 18:06:49 +01:00
Mihail Geshoski
8cdb2fcc0e MDL-62982 core_form: Final deprecation of the htmleditor form element 2020-07-06 10:02:58 +08:00
Davo Smith
5079271b39 MDL-43156 formslib: newly-created repeat elements get the default values 2020-04-30 20:16:07 +02:00
sam marshall
225eb7b27e MDL-66679 Forms: Submit button remains disabled after file download
When you download a file directly from a Moodle form submit button,
the submit button disables when you click it, but you remain on that
page so we need to re-enable the button.

This commit causes it to re-enable once the file download finishes,
setting a temporary cookie to indicate this to the JavaScript code.

It also adds a method to disable the system on a given form by
setting data-double-submit-protection="off".
2019-10-30 16:36:28 +00:00
Marina Glancy
57876874c3 MDL-66020 core_form: add date selector js only when rendered 2019-10-01 12:20:24 +02:00
Jake Dallimore
5120087808 MDL-66106 core_form: fix client side validation bug caused by MDL-65217
Forms with randomised ids need to support client side validation.
2019-09-20 09:03:25 +08:00
Peter
dfd0021749 MDL-65469 core: Expose formchecker to initialize current form state 2019-06-17 11:55:56 +08:00
Marina Glancy
8ff19f8c0f MDL-63685 core_form: for modal forms take parameters from request
When we deal with modal form submission we can not call optional_param inside the form class because
it does not have information from the AJAX form submission
2019-05-05 22:27:50 +02:00
Adrian Greeve
eee677c024 Merge branch 'MDL-53140-master' of git://github.com/rezaies/moodle 2019-05-01 10:30:22 +08:00
Shamim Rezaie
e240a0000a MDL-53140 forms: Added the float form element to the form API 2019-05-01 12:10:23 +10:00
Adrian Greeve
d61c9fb853 Merge branch 'MDL-65217-master' of git://github.com/marinaglancy/moodle 2019-05-01 08:35:41 +08:00
Adrian Greeve
f50b98dbe4 Merge branch 'MDL-64906_hideif_mod' of git://github.com/davosmith/moodle 2019-04-30 20:47:22 +02:00
Marina Glancy
f82c9d8d06 MDL-65217 form: option to randomise element ids 2019-04-29 14:23:27 +02:00
Damyon Wiese
260565e305 MDL-64573 output: ajax form event
Add an event that can be fired when an mform is about to be submitted via ajax.
This allows custom field types to perform an action when the form is submitted.

The atto text editor will reset any autosaves when the form is submitted.
2019-04-24 16:17:49 +08:00
Davo Smith
efc34ea5c9 MDL-64906 forms: add support for hideif to repeat_elements 2019-04-02 09:13:09 +01:00
Adrian Greeve
ceea116626 Merge branch 'MDL-55211-master' of git://github.com/damyon/moodle 2019-02-18 09:34:43 +01:00
Damyon Wiese
37910f5e9c MDL-55211 js: form/showadvanced yui to amd 2019-02-01 09:35:12 +08:00
Marina Glancy
4bfcadbaa1 MDL-64324 core_form: randomly generate id attribute on forms
otherwise there are id collisions in forms loaded in AJAX requests
2018-12-04 18:42:05 +01:00
Mark Nelson
2dd3384083 MDL-63001 core_form: final deprecation of the submitlink element 2018-07-27 16:05:28 +08:00
Tim Hunt
1872cfcd2f MDL-61928 formslib: shortforms should work with non-editable forms 2018-04-10 17:39:49 +01:00
Andrew Nicols
168fc2d9ec Merge branch 'MDL-61061_hideif_group' of git://github.com/davosmith/moodle 2018-01-10 08:46:05 +08:00
Davo Smith
c62f0a396b MDL-61061 formslib: add data-groupname to groups to fix hideIf rules 2017-12-19 10:47:54 +00:00
Davo Smith
8fc3d41139 MDL-61016 form: fix handling disabledIf + hideIf with same dependency 2017-12-12 14:53:33 +00:00
Marina Glancy
484b43f456 MDL-60281 general: create_function is deprecated in PHP7.2 2017-10-16 09:37:19 +08:00
Marina Glancy
3dee4faec4 MDL-59775 forms: add option to display any form vertical 2017-09-11 11:00:48 +08:00
Eloy Lafuente (stronk7)
f0e6ff9a8e Merge branch 'MDL-59669-master-3' of git://github.com/ryanwyllie/moodle 2017-08-29 02:15:18 +02:00