Generate bracketless tag id in FreeMarker forms

Before this change if FreeMarker Spring form macro was bound to a path
which contains square brackets, those brackets would also appear in id
of generated tag, making the id invalid.

As of this fix all FreeMarker Spring form macros generate tag with id
that does not contain square brackets.

Issue: SPR-8732
This commit is contained in:
Stevo Slavic
2012-03-04 22:02:38 +01:00
parent 9c8332a6c4
commit a9f4206151
3 changed files with 15 additions and 7 deletions

View File

@@ -260,6 +260,11 @@ public class FreeMarkerMacroTests {
assertTrue("Wrong output: " + output, output.contains("<input type=\"checkbox\" id=\"jedi\" name=\"jedi\" checked=\"checked\" />"));
}
@Test
public void testForm17() throws Exception {
assertEquals("<input type=\"text\" id=\"spouses0.name\" name=\"spouses[0].name\" value=\"Fred\" >", getMacroOutput("FORM17"));
}
private String getMacroOutput(String name) throws Exception {
String macro = fetchMacro(name);

View File

@@ -86,3 +86,6 @@ FORM15
FORM16
<@spring.formCheckbox "command.jedi"/>
FORM17
<@spring.formInput "command.spouses[0].name", ""/>