From the tag select, when using dataAttrs I'm getting can't getAt on null value
- Dominant language
- Groovy
- Stars
- 2.9k
- Forks
- 975
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 92
Description
### Steps to Reproduce
Use the select tag including dataAttrs.
### Expected Behaviour
1. The tag should check for errors like null element
2. It should report what when wrong instead of failing with a generic exception
3. The documentation could be improved with an example of using dataAttrs
4. Add test cases for select using dataAttrs (couldn't find any)
### Actual Behaviour
I tracked the issue in the code to this line https://github.com/grails/grails-gsp/blob/5.2.x/grails-plugin-gsp/src/main/groovy/org/grails/plugins/web/taglib/FormTagLib.groovy#L1122
It seems when passing a map like this [name: it.name] the 'it' used by other `select` options doesn't work, and there is no check for null to provide a correct message of what the error is.
I have found, by looking at the code that only this works, which is a little obscure: [name: 'name'], so for other options like optionValue (this works: `optionValue="${{it.templateId +' (v'+ it.versionNumber +')'}}"`)
So since dataAttrs don't support using it.xxx we neither can compose values like we can for optionValue, which would be useful for certain cases.
### Environment Information
$ grails -version
| Grails Version: 5.3.2
| JVM Version: 11.0.10
- **Operating System**: Linux Mint 17.3
### Example Application
- TODO
Contributor guide
Research direction
Start at grails-plugin-gsp/src/main/groovy/org/grails/plugins/web/taglib/FormTagLib.groovy around line 1122 and reproduce the select tag usage with dataAttrs described in the issue. Check the existing select-related tests, then define coverage for null-error reporting and dataAttrs behavior, with documentation examples where the supported usage is confirmed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100