Announcement Announcement Module
No announcement yet.
CustomBooleanEditor Help Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • CustomBooleanEditor Help

    Trying to process boolean checkbox, and I over road the getAsText and setAsText methods. The getAsText method is getting called but I never see the setAsText methods getting called. Can anyone shed any light on how this works and what I should do to update a boolean property based on a checkbox on the form?


  • #2
    I think your problem is that an HTML checkbox never gets submitted when it is not checked. When it is checked, its value will be submitted, when it is not checked, no value will be submitted at all!

    There are several work-arounds: detect non-submission on the server side, set a hidden field to reflect the value of the checkbox using JavaScript, ...



    • #3
      Spring automatically supports the use of a hidden field with the same name as the checkbox field except it has a '_' prefix, to handle checkboxes.

      Take a look at the JavaDocs for ServletRequestDataBinder; there's not much too it.