Details
Description
My TagLib is extending FormTagLib, with the next implementation:
def myMethod =
{ attrs, body -> attrs.name = "A" attrs.type = "text" attrs.tagName = "textField" fieldImpl(out, attrs) attrs.name = "B" attrs.type = "text" attrs.tagName = "textField" fieldImpl(out, attrs) }And the output is the next one:
<input type="text" name="A" id="A" value="" />
<input type="text" name="B" id="A" value="" />
Obviously the Id of the second element should be "B".
the problem is in this function in FormTagLib:
def fieldImpl(out, attrs) {
resolveAttributes(attrs)
attrs.id = attrs.id ?: attrs.name
out << "<input type=\"$
\" "
outputAttributes(attrs, out)
out << "/>"
}
The attrs.id is initialized with whatever comes in the attrs.name (only if attrs.id is empty), so my first call initializes the attrs.id, but in this other function:
void outputAttributes(attrs, writer) {
attrs.remove('tagName') // Just in case one is left
attrs.each
}
Doesn't remove the attrs (and I think it should do it, isn't it?), maybe something like this:
void outputAttributes(attrs, writer) {
attrs.remove('tagName') // Just in case one is left
attrs.each
}
Issue Links
- relates to
-
GRAILS-4975
g.createLink modifies Map object given as a params attribute
-
-
GRAILS-6744
Provide a performant and safe way for tag implementations to modify the incoming attributes
-
Activity
- All
- Comments
- Work Log
- History
- Activity
- Git Commits