tags:

views:

12

answers:

1

hi, i have a checkbox in jsf as follow. this jsf page is in the portal page. when i check the checkbox i get value as "on" and when i uncheck it i get the value as null. Why is it like that. the code is as below:

the checkbox is in formitem. isFullTimeStudent is of type Boolean

> <hx:formItem styleClass="formItem"
> id="fullTimeStudentFormItem"
>      showHelp="none"
>      label="&nbsp;&nbsp;#{giamsBundle['lbl.full.time.student']}">
>      <h:selectBooleanCheckbox id="fullTimeStudentChkBox"
>       value="#{pc_AssigneeDependents.dependent.isFullTimeStudent}"></h:selectBooleanCheckbox>
>     </hx:formItem>
A: 

The value on is the default HTTP request parameter value for a checked checkbox. You're apparently grabbing it raw from the request parameter map instead of accessing it by the property as bound by the input element's value attribute.

Don't use the request parameter map, just access it in the AssigneeDependents managed bean by dependent.getIsFullTimeStudent() which in turn should be a boolean or Boolean.

BalusC
Thanks Balus,i am using ajax on my page and i cant submit my page. thus have to get the values from the parameters. so when i check the checkbox i get on and when i uncheck i get null.