Hello,

We're running into an issue unchecking a checkbox in our account theme and came across the following post with no answer. As Libor asks the question elegantly, I'll copy his text verbatim and hope someone now has an answer.

Hi,
I’d like to use user attributes to store information like “Subscribe to newsletter” which is obviously checkbox.

How should I implement it in my account.ftl?

I have in account.flt:
<div class="form-group">
   <div class="checkbox">
      <label for="user.attributes.newsletter" class="control-label">
         <input type="checkbox" class="form-control" id="user.attributes.newsletter" name="user.attributes.newsletter" <#if account.attributes.newsletter??>checked</#if>/>
         ${msg("newsletter")}
      </label>
   </div>
</div>


When I tick it and submit form everything is OK but when untick it and submit then checkbox is still checked.
I guess it’s because checkbox state is included in HTTP Form Data only when it’s checked.

How to handle this in KC UI ?

I remember that other frameworks used some hidden fields to post the information either if checkbox was ticked or not. But I’m not sure how KC GUI framework handle this use case.

Thanks,

Libor Krzyžanek
jboss.org <http://jboss.org/> Development Team