SPR-8661 Add disabled attribute to HiddenInputTag
This commit is contained in:
@@ -35,6 +35,28 @@ import javax.servlet.jsp.JspException;
|
||||
@SuppressWarnings("serial")
|
||||
public class HiddenInputTag extends AbstractHtmlElementTag {
|
||||
|
||||
/**
|
||||
* The name of the '<code>disabled</code>' attribute.
|
||||
*/
|
||||
public static final String DISABLED_ATTRIBUTE = "disabled";
|
||||
|
||||
private String disabled;
|
||||
|
||||
/**
|
||||
* Get the value of the '<code>disabled</code>' attribute.
|
||||
*/
|
||||
public String getDisabled() {
|
||||
return this.disabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of the '<code>disabled</code>' attribute.
|
||||
* May be a runtime expression.
|
||||
*/
|
||||
public void setDisabled(String disabled) {
|
||||
this.disabled = disabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flags "type" as an illegal dynamic attribute.
|
||||
*/
|
||||
@@ -54,10 +76,20 @@ public class HiddenInputTag extends AbstractHtmlElementTag {
|
||||
tagWriter.startTag("input");
|
||||
writeDefaultAttributes(tagWriter);
|
||||
tagWriter.writeAttribute("type", "hidden");
|
||||
if (isDisabled()) {
|
||||
tagWriter.writeAttribute(DISABLED_ATTRIBUTE, "disabled");
|
||||
}
|
||||
String value = getDisplayString(getBoundValue(), getPropertyEditor());
|
||||
tagWriter.writeAttribute("value", processFieldValue(getName(), value, "hidden"));
|
||||
tagWriter.endTag();
|
||||
return SKIP_BODY;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Is the current HTML tag disabled?
|
||||
*/
|
||||
protected boolean isDisabled() throws JspException {
|
||||
return evaluateBoolean(DISABLED_ATTRIBUTE, getDisabled());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -652,6 +652,12 @@
|
||||
<required>false</required>
|
||||
<rtexprvalue>true</rtexprvalue>
|
||||
</attribute>
|
||||
<attribute>
|
||||
<description>HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element.</description>
|
||||
<name>disabled</name>
|
||||
<required>false</required>
|
||||
<rtexprvalue>true</rtexprvalue>
|
||||
</attribute>
|
||||
<attribute>
|
||||
<description>HTML Event Attribute</description>
|
||||
<name>onclick</name>
|
||||
|
||||
Reference in New Issue
Block a user