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

Custom User Profile Fields - Add ability to define an input mask for data validation

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Inactive
    • Affects Version/s: 1.9
    • Fix Version/s: None
    • Component/s: Administration
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE

      Description

      This question has been raised in response to the birthday block; however, I think it has utility regardless of use as it would allow for user's to be forced to input valid data. Using some type of input mask for data validation would be helpful. I'm thinking along the lines of:

      Date (ISO, USA, EUR)

      1. for a digit
        a for lower case alpha
        A for upper case alpha
        @ for alphanumeric
        All other characters would be literal

      Hence a mask for a U.S. phone number could be (###) ###-####

      That way if a Moodle administrator wanted to enforce that the data be entered properly they would have a tool by which to do it. AFAIK, since the data is simply stored as text there is currently no way of validating. The user's of the birthday block would like the users to input a birthday; however, they have no way of enforcing that the user input a valid date.

      Peace - Anthony

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            skodak Petr Skoda added a comment -

            I would personally prefer regex there, we already have this type of validation in admin settings.

            Show
            skodak Petr Skoda added a comment - I would personally prefer regex there, we already have this type of validation in admin settings.
            Hide
            aborrow Anthony Borrow added a comment -

            Skodak - Regex makes more sense then masks as it strikes me as more consistent with Moodle practices.

            Show
            aborrow Anthony Borrow added a comment - Skodak - Regex makes more sense then masks as it strikes me as more consistent with Moodle practices.
            Hide
            aborrow Anthony Borrow added a comment -

            As I have been looking at the database activity module code, it handles data validation and offers a variety of field types. I think it would be worth looking in to bringing those same field types in to the custom user profile types. Peace - Anthony

            Show
            aborrow Anthony Borrow added a comment - As I have been looking at the database activity module code, it handles data validation and offers a variety of field types. I think it would be worth looking in to bringing those same field types in to the custom user profile types. Peace - Anthony
            Hide
            aborrow Anthony Borrow added a comment -

            Just to be specific: checkbox, date, file, latlong, menu, multimenu, number, picture, radiobutton, text, textarea, and url. I also like the possibility that an additional field type could be added as a plugin to provide that validation. Peace - Anthony

            Show
            aborrow Anthony Borrow added a comment - Just to be specific: checkbox, date, file, latlong, menu, multimenu, number, picture, radiobutton, text, textarea, and url. I also like the possibility that an additional field type could be added as a plugin to provide that validation. Peace - Anthony
            Hide
            aborrow Anthony Borrow added a comment -

            There is a discussion forum (http://moodle.org/mod/forum/discuss.php?d=111049#p527700) in which Sean Farrelll provided some code for implementing something related to checking for dates. I have not looked carefully at the code to see what it actually does but wanted to at least make a reference to it here. Peace - Anthony

            Show
            aborrow Anthony Borrow added a comment - There is a discussion forum ( http://moodle.org/mod/forum/discuss.php?d=111049#p527700 ) in which Sean Farrelll provided some code for implementing something related to checking for dates. I have not looked carefully at the code to see what it actually does but wanted to at least make a reference to it here. Peace - Anthony
            Hide
            aborrow Anthony Borrow added a comment -

            Martin - Would it be a good idea to add a field to hold the value of a regular expression in the user_info_field table to allow data validation or should we just use param4 or param5? I figured if we were going to add a field for 2.0 then now is the time. Peace - Anthony

            Show
            aborrow Anthony Borrow added a comment - Martin - Would it be a good idea to add a field to hold the value of a regular expression in the user_info_field table to allow data validation or should we just use param4 or param5? I figured if we were going to add a field for 2.0 then now is the time. Peace - Anthony
            Hide
            marina Marina Glancy added a comment -

            We have detected that this issue has been inactive for over two years and also did not collect many votes. It is possible that it has been already implemented in a more recent version of Moodle, or it is not highly demanded. There are unlimited number of ways Moodle functinality can be expanded and improved but we would like to concentrate on the features that will benefit majority of users, and which can not be implemented as plugins. If you have a suggestion for improving Moodle core, and there is no open issue for it in the tracker, please start a new forum discussion to see how many other users agree with you, and then create a new issue providing as many details as possible.

            ==BLK2YIMP20141121==

            Show
            marina Marina Glancy added a comment - We have detected that this issue has been inactive for over two years and also did not collect many votes. It is possible that it has been already implemented in a more recent version of Moodle, or it is not highly demanded. There are unlimited number of ways Moodle functinality can be expanded and improved but we would like to concentrate on the features that will benefit majority of users, and which can not be implemented as plugins. If you have a suggestion for improving Moodle core, and there is no open issue for it in the tracker, please start a new forum discussion to see how many other users agree with you, and then create a new issue providing as many details as possible. ==BLK2YIMP20141121==

              People

              • Votes:
                5 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: