441 Commits

Author SHA1 Message Date
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
Ryan Wyllie
7ce44d8edc MDL-59669 forms: add helper to get submission keys for unit tests 2017-08-24 04:49:26 +00:00
Davo Smith
766d6f9a61 MDL-53848 form: hide entire group if hideIf test is applied to the group 2017-08-17 14:52:10 +01:00
Ankit Agarwal
988879655b MDL-53848 formslib: make conditional hidden elements properly accessible 2017-08-17 14:52:10 +01:00
Marina Glancy
f3da329da4 MDL-53848 forms: additions to the behat test 2017-08-17 14:52:10 +01:00
Davo Smith
d20498625c MDL-53848 form: add hideIf functionality 2017-08-17 14:52:10 +01:00
Damyon Wiese
a60e8ba51e MDL-59365 enrol_manual: Rewrite the yui enrolment popup in amd
The add/roles thing was only converted to bootstrap 2/4 markup and the yui left in place.

The modal for adding users to a course was unsavable so I rewrote it with an mform in a popup, still calling
the same (barely) modified ajax script.

The webservice for searching cohorts was taken from admin/tool/lp and moved into /cohort. I added a generic "cohort"
mform element at the same time.

The webservice for searching for users was taken from the original ajax script.
2017-07-11 13:47:26 +01:00
David Mudrák
6c8e25fa51 MDL-59443 forms: Give elements a chance to validate submitted values
This patch introduces support for an optional method provided by the
form element classes to validate the submitted values implicitly -
without the need to have the rule explicitly added via the form
definition.

I am aware this should ideally be added to the HTML_QuickForm_element
parent class. But I wanted to avoid modification of that third party
library and keep the change in the moodleform layer only.
2017-07-06 09:29:04 +02:00
Jonathon Fowler
97bb4f755e MDL-53240 filetypes: Introduce the form element to specify plugin types
This is a stripped down version of the original Jonathon's element
without the actual JS selector. The options "allowall" and "onlytypes"
are not fully supported right now yet.
2017-06-01 09:18:38 +02:00
Dan Poltawski
48f5c05019 Merge branch 'wip-MDL-34859-master' of git://github.com/marinaglancy/moodle 2017-03-20 07:54:22 +00:00
Marina Glancy
b4eb5f0212 MDL-34859 forms: new element defaultcustom 2017-03-20 14:59:45 +08:00
Damyon Wiese
663640f5b3 MDL-40759 icons: convert uses of pix_url to pix_icon
Also change filepicker to use scaled svgs instead of sets of custom pngs. The svgs are taken from font-awesome.
2017-03-17 15:52:17 +08:00
Damyon Wiese
a26ce2482a MDL-40759 themes: font awesome support
We add a new theme config so the theme can say it supports font-awesome.
If this is true, the pix_icon renderer will call a mapping function to map
from the moodle style t/edit to a font-awesome style fa-cog icon name. Then the renderer
will either render an image tag for old icons - or an accessible font-awesome <i> tag.

This mostly works - but there are some places where we don't use the pix icon renderer, and
we directly create image tags with pix_url image sources. These will need updating (Atto icons,
drag and drop move icons, editpdf icons).
2017-03-17 15:51:28 +08:00
Frederic Massart
547801a411 MDL-57273 form: Persistent form automatically setType on some fields 2017-01-20 12:56:19 +08:00
godric
4c4b966a92 MDL-40132 lib: Using compare rule results in fatal error.
In getValidationScript function variable $element can be an array or object.
Function attempt get non-existing attributes.
To avoid this we should check before accessing.
2017-01-07 09:40:27 +03:00
Dan Poltawski
2fa2ed50eb MDL-57471 forms: deprecate init_javascript_enhancement()
This was half-finished and only used for the smartselect enhancement. That
enhancement doesn't work with theme_boost and is better replaced just
using the searchableselector element.
2016-12-22 12:19:51 +00:00
Daniel Thee Roperto
518eb19337 MDL-56233 forms library: Fixed form identifier when mocking a form.
If the plugin is using namespaces instead of frankenstyle class name,
get_called_class() will return 'type\name' instead of 'type_name'.

Added code to replace backslashes to underscores and fix that issue.
2016-12-05 11:27:05 +11:00
Eloy Lafuente (stronk7)
0d80f6984b Merge branch 'MDL-56250-32-formvalidation' of https://github.com/roperto/moodle 2016-10-25 20:23:12 +02:00
Andrew Nicols
ac157b0bbe MDL-53048 forms: Deprecate prevent_form_autofill_password 2016-10-24 08:19:44 +08:00
Daniel Thee Roperto
8b9ca065d8 MDL-56250 forms library: Changed form to validate once per object.
If two instances of moodleforms are validated in the same run, most
likely a phpunit test run, it would store the first validation result.
Now it stores the validation result per instance, not for all instances.
2016-10-21 10:43:03 +11:00
Damyon Wiese
e584e6ae46 MDL-55071 theme/output: PHPCS fixes for new theme branch
Part of MDL-55071
2016-09-23 10:57:36 +01:00
Frederic Massart
8a40bc36a6 MDL-51948 admin: Guess RTL compatibility of settings using PARAM_ types
Part of MDL-55071
2016-09-23 10:57:35 +01:00
Frederic Massart
3264bf5b56 MDL-55593 form: Wrap skip validation variable in script tag
Part of MDL-55071
2016-09-23 10:55:18 +01:00
Damyon Wiese
63e4df60f6 MDL-55839 behat: Behat fixes for theme_noname
This is a squash of many small fixes.
The list of changes are:

Initial set of behat selectors overrides required for new theme.

set core behat selectors if not overridden by theme

Remove pause

Fix for checkboxes not saving properly

Custom override for click in the user menu

Fix for behat guessing the field type.

Behat fix for guessing the correct field type.

Fix for missing closeElementBefore mforms mess.

Fix for textareas not displaying their contents.

Fix availability form element

Fix action menu selectors for activities in a course page

Fix textareas not retaining their values

Fix selector for blocks

I had to change the single select template to use an input instead of a button because of a
behat bug we have not tracked down yet.

Fix for frozen attribute in form elements

Use input instead of button while behat is still broken

Fix for navigation selector override

Behat selector fixes and multi-select fixes for templated select

Fix for configure blocks selector + booleans for autocomplete

Fixes for course_summary behat tests

Allow optgroups in single_select

Behat fixes for block_navigation

Fixes for url form element and activity chooser selectors

blocks_social - fix specific selector for behat

Fix export_for_template for selectgroups element.

Dont set empty id on the form

Fix direct call to behat_navigation in backup context

Checkbox empty value fix

Fix for assign grading panel popouts

file picker overrides to find a file manager in the page

Fix chat tests to use element name

Make selectors in mod_data behat less specific

MDL-55839: recent activity behat test relies on time()

SQUASH Honour mform element "class" attribute on the container

SQUASH Fixes for behat in mod_forum

SQUASH search form template showing value as text next to the button

SQUASH undo double selectgroup fix

SQUASH - The slightly different structure to action menus breaks course drag and drop

SQUASH Wrap loading icon in a span so the selector still works.

SQUASH Fix fragile javascript in report_loglive

SQUASH Fix tabtree, and selectgroups for mod_feedback

Also - do-not enhance the action menu - we are dropping support for this.

SQUASH Fix filemanager selector and pix_icon template for mod_forum tests.

SQUASH Fixes to breadcrumb and add formid to single select (fixes mod_glossary tests)

SQUASH lesson behat fixes. 95% of lesson styles were rubbish so they were disgarded.

SQUASH Fix lti behat tests - they were cheating and using a context step from quiz

SQUASH Behat fixes for quiz with new theme

SQUASH behat fixes for mod_wiki

SQUASH Workshop behat fixes

SQUASH Frozen form elements cannot use a readonly form element because it screws with the form JS "disabledIf" stuff.

SQUASH Fixes for grades behat tests

SQUASH behat fixes for groups

SQUASH blacklist action menu tests

SQUASH Fix for tag form element missing "manage standard tags" link

SQUASH Incomplete fixes for course behat tests

SQUASH behat fixes for badges

SQUASH Tags fixes for behat

SQUASH filepicker fixes for behat

SQUASH Abort guessing field type when we hit 'html'

SQUASH Fix for admin/tool/behat tests

SQUASH fix for admin tool behat tests

SQUASH fix for availabilty conditions hiding "aria-hidden" elements

SQUASH give the blocks more room. We get behat files because nav tree nodes are not in view

SQUASH Blocks fixed

Fix behaviour of unchecked checkboxes

SQUASH Remove incorrect step in user test

SQUASH behat fixes for course tests

Part of MDL-55071
2016-09-23 10:55:16 +01:00
Frederic Massart
df07fead55 MDL-55829 form: Define 'skipClientValidation' as a global JS var
Part of MDL-55071
2016-09-23 10:55:16 +01:00
Frederic Massart
fc7f69e7e8 MDL-51948 formslib: Support forcing LTR on form elements
Part of MDL-55071
2016-09-23 10:54:49 +01:00
Damyon Wiese
d6f2ce1486 MDL-55656 theme_noname: Include advanced and required field markup
The new form elements were not including the markup for advanced
and required fields. I used an <abbr> tag in the label to give
and accessible indication of the advanced and required fields.

Part of MDL-55071
2016-09-23 10:53:56 +01:00
Damyon Wiese
91bda4cd45 MDL-55417 forms: Render form elements with a template
This change allows form elements to be overridden with a mustache template.
The template can even listen for form validation errors and supply the JS to
change the look of the form element when there is/isn't a validation error.

Initial support is for all core form elements including:

text, select, selectyesno and checkboxes, groups, dateselector, datetimeselector,
autocomplete, modvisible, advcheckbox, button, duration, filemanager, filepicker, editor, static, grading,
warning, textarea, password, url, submit, questioncategory, recaptcha.

Part of MDL-55071
2016-09-23 10:53:30 +01:00