Fixes translating id in Form tag

This commit is contained in:
Lukasz Lenart
2020-11-25 17:12:57 +01:00
parent a2df8f9890
commit dfa8fb3e4c
3 changed files with 23 additions and 1 deletions
@@ -221,7 +221,7 @@ public class Form extends ClosingUIBean {
@Override
protected void populateComponentHtmlId(Form form) {
if (id != null) {
addParameter("id", escape(id));
super.populateComponentHtmlId(null);
}
// if no id given, it will be tried to generate it from the action attribute
@@ -186,6 +186,25 @@ public class FormTagTest extends AbstractUITagTest {
verify(FormTag.class.getResource("Formtag-1.txt"));
}
public void testFormId() throws Exception {
request.setupGetServletPath("/testAction");
TestAction testAction = (TestAction) action;
testAction.setFoo("bar");
FormTag tag = new FormTag();
tag.setPageContext(pageContext);
tag.setMethod("post");
tag.setAction("myAction");
tag.setId("myid-%{foo}");
tag.doStartTag();
tag.doEndTag();
verify(FormTag.class.getResource("Formtag-29.txt"));
}
public void testFormNoNameOrId() throws Exception {
request.setupGetServletPath("/testAction");
@@ -0,0 +1,3 @@
<form id="myid-bar" name="myid-bar" action="myAction" method="post">
<table class="wwFormTable"></table>
</form>