Skip to content

Commit

Permalink
Merge pull request apache#572 from apache/WW-5191-textarea-max-length
Browse files Browse the repository at this point in the history
[WW-5191] Fixes placement of maxLength and minLength attributes in <s:textarea/> tag
  • Loading branch information
yasserzamani authored Jun 17, 2022
2 parents ba041e1 + 0e4d596 commit e6bc93d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void setRows(String rows) {
public void setWrap(String wrap) {
this.wrap = wrap;
}

public void setMaxlength(String maxlength) {
this.maxlength = maxlength;
}
Expand All @@ -100,6 +100,8 @@ protected void clearTagStateForTagPoolingServers() {
this.readonly = null;
this.rows = null;
this.wrap = null;
this.maxlength = null;
this.minlength = null;
}

}
14 changes: 7 additions & 7 deletions core/src/main/resources/template/simple/textarea.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@
<#if parameters.title?has_content>
title="${parameters.title}"<#rt/>
</#if>
<#if parameters.maxlength?has_content>
maxlength="${parameters.maxlength}"<#rt/>
</#if>
<#if parameters.minlength?has_content>
minlength="${parameters.minlength}"<#rt/>
</#if>
<#include "/${parameters.templateDir}/${parameters.expandTheme}/scripting-events.ftl" />
<#include "/${parameters.templateDir}/${parameters.expandTheme}/common-attributes.ftl" />
<#include "/${parameters.templateDir}/${parameters.expandTheme}/dynamic-attributes.ftl" />
><#rt/>
<#if parameters.nameValue??>
<@s.property value="parameters.nameValue"/><#t/>
</#if>
<#if parameters.maxlength?has_content>
maxlength="${parameters.maxlength}"<#rt/>
</#if>
<#if parameters.minlength?has_content>
minlength="${parameters.minlength}"<#rt/>
</#if>
</textarea>
</textarea>
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public void testSimple() throws Exception {
tag.setId("the_id");
tag.setOnkeyup("alert('hello');");
tag.setReadonly("true");
tag.setMaxlength("100");
tag.setMinlength("10");

tag.doStartTag();
tag.doEndTag();
Expand Down Expand Up @@ -81,6 +83,8 @@ public void testSimple_clearTagStateSet() throws Exception {
tag.setId("the_id");
tag.setOnkeyup("alert('hello');");
tag.setReadonly("true");
tag.setMaxlength("100");
tag.setMinlength("10");

tag.doStartTag();
setComponentTagClearTagState(tag, true); // Ensure component tag state clearing is set true (to match tag).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<tr>
<td class="tdLabel"><label for="the_id" class="label">mylabel:</label></td>
<td class="tdInput"><textarea name="myname" cols="20" rows="30" disabled="disabled" readonly="readonly" tabindex="5" id="the_id" title="mytitle" onclick="alert('onclick');" onkeyup="alert('hello');" onchange="alert('goodbye');">bar</textarea></td>
<td class="tdInput"><textarea name="myname" cols="20" rows="30" disabled="disabled" readonly="readonly" tabindex="5" id="the_id" title="mytitle" maxlength="100" minlength="10" onclick="alert('onclick');" onkeyup="alert('hello');" onchange="alert('goodbye');">bar</textarea></td>
</tr>

0 comments on commit e6bc93d

Please sign in to comment.