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

Allow text customfield to be text or textarea form input type

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Reopened
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.9.1
    • Fix Version/s: None
    • Component/s: Other
    • Testing Instructions:
      Hide

      (difficulty: easy, requires admin access, test course created)

      1. Log in as admin
      2. Navigate Courses > Course custom fields in Site Administration
      3. Click Add a new category and create a test category, note the name of the created Category (default is 'Other fields')
      4. Click the Add a new custom field link in your created Category and select Short text from the dropdown options, this should load a form for creating custom field
      5. Under the Short text field settings section of the form you should see new form elements 'Use textarea' and 'Form input height'
      6. 'Form input height' should be disabled while 'Use textarea' is set to 'No'
      7. Change 'Use textarea' to 'Yes' and 'Form input height' should be enabled
      8. 'Password field' should be disabled while 'Use textarea' is set to 'Yes'
      9. Change 'Use textarea' to 'No' and 'Password field' should be enabled
      10. Set 'Password field' to 'Yes', 'Use textarea' input should be disabled
      11. Change 'Password field' to 'No' and 'Use textarea' should be enabled.
      12. Under the General section of the form, set 'Name' input to 'Test field' and 'Shortname' input value to 'testfield'
      13. Under the Short text field settings section set 'Use textarea' to 'Yes' and enter a value of '0' into the 'Form input height' input.
      14. Click Save changes button at bottom of form
      15. You should see an error message under the 'Form input height' input saying 'The form input height must be between 1 and 10 rows.'
      16. Enter a value of '5' into the 'Form input height' input and set the value of 'Form input size' to '0'.
      17. Click Save changes button at bottom of form
      18. You should see an error message under the 'Form input size' input saying 'The form input size must be between 1 and 200 characters.'
      19. Enter a value of '50' into the 'Form input size' input
      20. Click Save changes button at bottom of form, the form should now save correctly and return you to the Course custom fields page.
      21. You should see your created custom field in the table with 'Customfield' = 'Test field', 'Short name' = 'testfield' and 'Type' = 'Short text'
      22. Navigate to a test course
      23. Use the Actions menu (⚙️ icon top right) and select Edit settings from the drop down
      24. Expand the settings section matching your created field Category name (default is 'Other fields') and you should be able to see a field named 'Test field', this should be a textarea type input
      25. Enter test content into the 'Test field' input to check that it is 5 rows high and note content
      26. Click 'Save and display' to return to course
      27. Go back into settings ( Actions menu > Edit settings > expand section) and check that the content you entered was saved correctly
      Show
      (difficulty: easy, requires admin access, test course created) Log in as admin Navigate Courses > Course custom fields in Site Administration Click Add a new category and create a test category, note the name of the created Category (default is 'Other fields') Click the Add a new custom field link in your created Category and select Short text from the dropdown options, this should load a form for creating custom field Under the Short text field settings section of the form you should see new form elements 'Use textarea' and 'Form input height' 'Form input height' should be disabled while 'Use textarea' is set to 'No' Change 'Use textarea' to 'Yes' and 'Form input height' should be enabled 'Password field' should be disabled while 'Use textarea' is set to 'Yes' Change 'Use textarea' to 'No' and 'Password field' should be enabled Set 'Password field' to 'Yes', 'Use textarea' input should be disabled Change 'Password field' to 'No' and 'Use textarea' should be enabled. Under the General section of the form, set 'Name' input to 'Test field' and 'Shortname' input value to 'testfield' Under the Short text field settings section set 'Use textarea' to 'Yes' and enter a value of '0' into the 'Form input height' input. Click Save changes button at bottom of form You should see an error message under the 'Form input height' input saying 'The form input height must be between 1 and 10 rows.' Enter a value of '5' into the 'Form input height' input and set the value of 'Form input size' to '0'. Click Save changes button at bottom of form You should see an error message under the 'Form input size' input saying 'The form input size must be between 1 and 200 characters.' Enter a value of '50' into the 'Form input size' input Click Save changes button at bottom of form, the form should now save correctly and return you to the Course custom fields page. You should see your created custom field in the table with 'Customfield' = 'Test field', 'Short name' = 'testfield' and 'Type' = 'Short text' Navigate to a test course Use the Actions menu (⚙️ icon top right) and select Edit settings from the drop down Expand the settings section matching your created field Category name (default is 'Other fields') and you should be able to see a field named 'Test field', this should be a textarea type input Enter test content into the 'Test field' input to check that it is 5 rows high and note content Click 'Save and display' to return to course Go back into settings ( Actions menu > Edit settings > expand section) and check that the content you entered was saved correctly
    • Affected Branches:
      MOODLE_39_STABLE
    • Pull Master Branch:
      MDL-69335-310-customfield_text_allow_textarea_input_type

      Description

      Currently when utilising the customfield_text customfield type, the text input size is limited and may be too small for some longer values.

      It would be good if we could add the option (using a customfield configdata attribute) to use a textarea input type (the form element 'textarea') instead of always using a text input type (the form element 'text), for times when we want to display a longer text setting which doesn't require rich text editing.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            tom_d Tom Dickman
            Peer reviewer:
            Dmitrii Metelkin
            Integrator:
            Adrian Greeve
            Participants:
            Component watchers:
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 hours
                3h