Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-649

checkboxes not handled by SlingPostServlet

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • Servlets Post 2.1.0
    • Servlets
    • None
    • Ubuntu AMD64 FF3

    Description

      I am trying to use checkboxes with the SlingPostServlet, as described in http://incubator.apache.org/sling/site/manipulating-content-the-slingpostservlet.html
      <form method="POST" action="/content/page/first">
      <input type="text" name="width" />
      <input type="hidden" name="width@TypeHint" value="Long" />
      <input type="checkbox" name="checked" />
      <input type="hidden" name="checked@TypeHint" value="Boolean" />
      ...
      <input type="Submit" />
      </form>

      All elements work fine, excepte the checkbox: the "checked" node property is always set to false in JCR after a POST. Can anyone confirm?

      I guess it's because the POST request parameters are:
      width 1234
      width@TypeHint Long
      checked on
      checked@TypeHint Boolean
      So, the passed checkbox parameter is "on" instead of "true"

      I guess I would have to modify SlingPropertyValueHandler.setPropertyAsIs() to handle "on" values as "true" if @TypeHint is Boolean. Similar to how dates values are handled if @TypeHint = date.
      If it's the right way to go, I will create a patch.

      Attachments

        1. SLING-649.patch
          6 kB
          Justin Edelson

        Activity

          People

            justinedelson Justin Edelson
            renaudrichardet Renaud Richardet
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: