Hi,
I've a page with a checkbox and some input fields. I want to disable and
clear some fields when the
checkbox is checked. I do this with a change facet and a command tag.
Disabling the fields works
but not clearing. When the field is disabled clearing the field (setting to
null in the action) has no effect.
Clearing works when the field is not disabled. I think this is a very common
and simple use case which
should work.
Regards
Helmut
This is the JSP code:
<tc:panel id="inputPanel">
<tc:selectBooleanCheckbox id="checkbox"
value="#{controller.checkbox}">
<f:facet name="change">
<tc:command action="#{controller.checkboxChangeAction}">
<tc:attribute name="renderedPartially" value="inputPanel"/>
</tc:command>
</f:facet>
</tc:selectBooleanCheckbox>
<tc:in id="input"
disabled="#{controller.checkbox}"
value="#{controller.value}"/>
</tc:panel>
And the java code:
private boolean checkbox;
private String value;
public void checkboxChangeAction() {
LOG.debug("checkboxChangeAction");
if (checkbox) {
value = null;
}
}
public boolean isCheckbox() {
return checkbox;
}
public void setCheckbox(boolean checkbox) {
this.checkbox = checkbox;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}