I am also having this issue. I have attached some of the JSF items to
demonstrate the issue. When the user clicks submit and the ajax checkbox is
unchecked the checkbox refreshes with it checked. I am checking the value in
the backing bean and this is coming through as true, so by the Invoke
Application phase the problem is already present. I am also checking the
value in the javascript function and this is stating that it is unchecked so
it is definately sending the value correctly.
Any help would be greatly appreciated.
Firstly the JSP:
<webuijsf:head id="head1">
<webuijsf:link id="link1"
url="/resources/stylesheet.css"/>
<df:ajaxTransaction id="checkboxTx"
inputs="page1:html1:body1:form1:buttonSubmit,page1:html1:body1:form1:checkbox1"
render="page1:html1:body1:form1:checkbox1"/>
<webuijsf:script id="script1"
url="resources/javascript.js"/>
</webuijsf:head>
<webuijsf:body id="body1" style="-rave-layout: grid">
<webuijsf:form id="form1">
<webuijsf:staticText id="staticText1"
style="position: absolute; left: 24px; top: 24px" text="Version 1.0"/>
<h:selectBooleanCheckbox
binding="#{AjaxCheckbox.checkbox1}" id="checkbox1" style="position:
absolute; left: 120px; top: 96px"/>
<h:selectBooleanCheckbox id="checkbox2"
style="position: absolute; left: 120px; top: 144px"/>
<h:commandButton
action="#{AjaxCheckbox.buttonSubmit_action}" id="buttonSubmit"
onclick="fireCheckboxTx();return false;"
style="left: 120px; top: 48px; position:
absolute" value="Submit"/>
<h:outputText id="outputText1" style="left: 147px;
top: 93px; position: absolute" value="Ajax"/>
<h:outputText id="outputText2" style="position:
absolute; left: 144px; top: 144px" value="Non Ajax"/>
</webuijsf:form>
</webuijsf:body>
Secondly the javascript:
function fireCheckboxTx() {
var checkbox1 = document.getElementById("form1:checkbox1");
if(checkbox1.checked) {
alert('Ajax checkbox is checked');
} else {
alert('Ajax checkbox is not checked');
}
DynaFaces.Tx.fire('checkboxTx');
}
and finally the button method in the backing bean:
public String buttonSubmit_action() {
Object o = checkbox1.getValue();
logger.info("class type: " + o.getClass().getName());
Boolean b = (Boolean) o;
logger.info("value is " + b.booleanValue());
return null;
}
autozoom wrote:
>
> When you use a checkbox or a radiobutton as an input for a Dynamic Faces
> transaction, you always get the "checked" value regardless of the actual
> control status.
> Anyone knows why?
>
--
View this message in context: http://www.nabble.com/checkbo-radiobutton-and-Ajax-transaction-error-tp19836978p20733406.html
Sent from the Project Woodstock - Users mailing list archive at Nabble.com.