Grails
  1. Grails
  2. GRAILS-3468

Add DISABLED and READONLY attributes to the form tags

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.0.3
    • Fix Version/s: 2.1-RC1
    • Component/s: TagLib
    • Labels:
      None

      Description

      I would be useful if various form tags would have READONLY and DISABLED options.

      Currently the g:checkbox tag already contains the option to define if it's checked or not using a expression. The same would be useful for READONLY and DISABLED.

      E.g.

      <g:checkBox name="someName" value="1" disabled="$

      {session.user.isAdmin}

      " /> <g:message code="day.1" default="Monday" />

        Activity

        Hide
        Denis Alessandro Altoé Falqueto added a comment -

        Hi! I would like to help fixing this issue. I have a patch for it in https://github.com/denisfalqueto/grails-core/commit/1809b05fd3cee8bd6e472b56309e82d932bf5b58. I can add test cases, if needed.

        Show
        Denis Alessandro Altoé Falqueto added a comment - Hi! I would like to help fixing this issue. I have a patch for it in https://github.com/denisfalqueto/grails-core/commit/1809b05fd3cee8bd6e472b56309e82d932bf5b58 . I can add test cases, if needed.
        Hide
        Ian Roberts added a comment -

        I like the fix, but in its current form it breaks existing GSPs that use constructs like:

        <g:textField name="foo" disabled="disabled" />
        

        (since Boolean.valueOf("disabled") == false). Maybe modify booleanToAttribute to treat attr == attrName as a true case?

        Show
        Ian Roberts added a comment - I like the fix, but in its current form it breaks existing GSPs that use constructs like: <g:textField name= "foo" disabled= "disabled" /> (since Boolean.valueOf("disabled") == false ). Maybe modify booleanToAttribute to treat attr == attrName as a true case?
        Hide
        Denis Alessandro Altoé Falqueto added a comment -

        Exactly! I was thinking about that just now. I'll add a new commit to the same branch as soon as possible.

        Show
        Denis Alessandro Altoé Falqueto added a comment - Exactly! I was thinking about that just now. I'll add a new commit to the same branch as soon as possible.
        Hide
        Denis Alessandro Altoé Falqueto added a comment -

        I've made two pull requests for the fix (one for master and one for the 2.0.x branch):

        https://github.com/grails/grails-core/pull/159
        https://github.com/grails/grails-core/pull/160 (backport)

        Show
        Denis Alessandro Altoé Falqueto added a comment - I've made two pull requests for the fix (one for master and one for the 2.0.x branch): https://github.com/grails/grails-core/pull/159 https://github.com/grails/grails-core/pull/160 (backport)
        Hide
        Graeme Rocher added a comment -

        Thanks!

        Show
        Graeme Rocher added a comment - Thanks!
        Hide
        Henry Zaccak added a comment -

        This option needs to be added to the documentation for the g:checkBox tag.

        Show
        Henry Zaccak added a comment - This option needs to be added to the documentation for the g:checkBox tag.

          People

          • Assignee:
            Graeme Rocher
            Reporter:
            Marcel Overdijk
          • Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Last Reviewed:

              Development