Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

From the tag select, when using dataAttrs I'm getting can't getAt on null value #335

Open
ppazos opened this issue Mar 30, 2023 · 0 comments

Comments

@ppazos
Copy link

ppazos commented Mar 30, 2023

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant