Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-40884

Allow form fields to be locked by capability checks

    XMLWordPrintable

    Details

      Description

      We could have an option in formslib to lock some fields of a form depending on the capabilities that the current user has.

      Firstly, this prevents a mix of if/else in the form definition.
      Secondly, we can provide a template for such type of "lock" to represent them visually.
      Thirdly, we provide a standard way of locking a field, which leads to more consistency throughout the forms.

      While chatting with Dan about it, we have to keep in mind that this is not an option to hide fields from the user and should not be use with that purpose in mind. Some fields must be hidden, maybe we could also have an option to hard freeze an option when the user is not supposed to see it.

      I am attaching a quick patch, and a screenshot, as a proof of concept.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                fred Frédéric Massart
                Participants:
                Component watchers:
                Jake Dallimore, Jun Pataleta, Ryan Wyllie, Barbara Ramiro, Jake Dallimore, Jun Pataleta, Ryan Wyllie
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated: