-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Description
Pablo opened SPR-7710 and commented
In freemarker, if I use the formInput macro with an array parameter:
<@spring.formInput "command.values[0]"/>
spring generates a form with an invalid id: 'values[0]'
This is related to https://jira.springframework.org/browse/SPR-2380, which was the same bug but with jsp. It is possible that the same happens with velocity.
To fix it in freemarker, you can change, in spring.ftl:
160c160
< <input type="${fieldType}" id="${status.expression}" name="${status.expression}" value="<#if fieldType!="password">${stringStatusValue}</#if>" ${attributes}<@closeTag/>
—
<input type="${fieldType}" id='${status.expression?replace("[", "")?replace("]", "")}' name="${status.expression}" value="<#if fieldType!="password">${stringStatusValue}</#if>" ${attributes}<
@closeTag/>
This change replaces the [ and ] with _.
I am currently using spring 2.5, so it would be nice to have it backported, if possible.
thanks a lot.
Affects: 2.0.8, 2.5 RC1, 2.5 RC2, 2.5 final, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.5.5, 2.5.6, 3.0 M1, 3.0 M2, 3.0 M3, 3.0 M4, 3.0 RC1, 3.0 RC2, 3.0 RC3, 3.0 GA, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.0.5
Issue Links:
- Using array syntax generates invalid id using freemarker [SPR-8732] #13374 Using array syntax generates invalid id using freemarker ("is duplicated by")