You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Justin Edelson (JIRA)" <ji...@apache.org> on 2010/05/18 18:12:43 UTC

[jira] Updated: (SLING-649) checkboxes not handled by SlingPostServlet

     [ https://issues.apache.org/jira/browse/SLING-649?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Justin Edelson updated SLING-649:
---------------------------------

    Attachment: SLING-649.patch

Here's a proposed patch for this issue. It adds a new hint field @UseDefaultWhenMissing. Used like this:

<input name="queryIgnoreNoise" class="input" type="checkbox" value="true">
<input type="hidden" name="queryIgnoreNoise@DefaultValue" value="false"> 
<input type="hidden" name="queryIgnoreNoise@UseDefaultWhenMissing" value="true"> <!-- value is irrelevant -->

 


> checkboxes not handled by SlingPostServlet
> ------------------------------------------
>
>                 Key: SLING-649
>                 URL: https://issues.apache.org/jira/browse/SLING-649
>             Project: Sling
>          Issue Type: Improvement
>          Components: Servlets
>         Environment: Ubuntu AMD64 FF3
>            Reporter: Renaud Richardet
>            Priority: Minor
>         Attachments: SLING-649.patch
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.