Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
250
Problem with ig:checkBox value attribute
posted

I have a problem using ig:checkBox value attribute. The attribute in the backing bean bound to the value of the checkbox isn't updated after form submission.
The code is given below:
JSP:
...
<ig:checkBox id="chkbox2" value="#{RenderPageBean.checkBoxBool}"/>
<h:commandButton value="Submit" type="submit" action="#{RenderPageBean.submitActionIGBool}"/>
...

Backing Bean:

...
public String submitActionIGBool() {
 if (checkBoxBool) {
  result = new ArrayList(dao.getPositions());
 } else {
  result = new ArrayList(dao.getTrades());
 }
 System.out.println("$$$$$$$$$$$ checkBoxBool " + checkBoxBool);
 return "refresh";
}
...

I m using NetAdvantage for JSF 1.1 2009 Vol 1. I would like to know if this is a bug. If yes, when can we expect a fix on this?

  • 1324
    Verified Answer
    posted

    Hello,

    You should bind the "checked" attribute of the ig:checkBox instead of "value" attribute.

    Replace the  <ig:checkBox id="chkbox2" value="#{RenderPageBean.checkBoxBool}"/> By

    <ig:checkBox id="chkbox2" checked="#{RenderPageBean.checkBoxBool}"/>

    Hope it solve your problem.

    Roshan