On Tue, Feb 23, 2010 at 3:51 PM, Justin Edelson <justinedel...@gmail.com> wrote:
> I'm having a problem which is primarily a UI issue, but I think would be
> best addressed in the post servlet. Basically, I have a form with
> multiple form fields for the same property and some of those are blank,
> so my post parameters end up like this:
>
> ./stringprope...@typehint=string[]
> ./stringProperty=foo
> ./stringProperty=bar
> ./stringProperty=
>
> This results in stringProperty getting set to ['foo','bar',''], which
> isn't what I want (I want ['foo','bar']).
>
> What I'd like to do is add @ExcludeBlanks as a new hint, so that
>
> ./stringprope...@typehint=string[]
> ./stringprope...@excludeblanks=true
> ./stringProperty=foo
> ./stringProperty=bar
> ./stringProperty=
>
> results in the array of two values.
>
> WDYT?

I'm not sure if the SlingPostServlet should handle this, or if we
should demand the client to be smart enough to not post empty params
if it doesn't want to set a field.
Also, maybe @IgnoreBlanks would be a better name?

In any case, if @ExcludeBlanks/@IgnoreBlanks is implemented, it should
apply to single-value properties as well, for consistency.
So that a post with fields
./stringprope...@typehint=string
./stringprope...@excludeblanks=true
./stringProperty=
... should leave ./stringProperty unchanged.

-- 
Vidar S. Ramdal <vi...@idium.no> - http://www.idium.no
Sommerrogata 13-15, N-0255 Oslo, Norway
+ 47 22 00 84 00 / +47 21 531941, ext 2070

Reply via email to