Thanks for the response.
The node is a special node type. I'm not sure about the property.
I thought the "hint" would make it an array
<input type="hidden" name="[EMAIL PROTECTED]" value="String[]" />
I did manage to get it work with:
var items = currentNode.getProperty("trackId").values;
for( var i=0; i < items.length; i++ ) {
.....
I think the servlet is doing the right thing (using the hint) because
getting the node as json shows the property as an array (even if only
one item).
On Thu, Aug 7, 2008 at 11:43 AM, Felix Meschberger <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Sounds like the ScriptableNode wrapper returns currentNode.trackId as a
> single property instead of an array of properties. This single property is
> then converted to a string and the characters iterated.
>
> Do you store the property in a node of a special node type or is it of type
> nt:unstructured ? Can you tell me whether the property is mult-value:
> currentNode.getProperty("trackId").definition.isMultiple() would return
> true. Otherwise false is returned.
>
> The reason why I ask is to try and find out, whether your problem happens
> upon storage in SlingPostServlet or up "read" in the ScriptableNode wrapper.
>
> Regards
> Felix
>
>
> Paul Davis schrieb:
>>
>> Hi,
>>
>> I've got a form where there my be an arbitrary number of items.
>> However, I have a problem when there is only one item.
>>
>> I've added the type hint
>> <input type="hidden" name="[EMAIL PROTECTED]" value="String[]" />
>> The type hint works when I get the json string. The value is correctly
>> wrapped in square brackets.
>>
>> However, in my esp, it iterates the letters of the value (if there is only
>> one)
>> <% for(var i=0; i <currentNode.trackId.length; i++) { %>
>> <div><%= currentNode.trackId[i] %></div>
>> <% } %>
>>
>> I tried using the typeof(obj) operation in a test but, it returns
>> "object" regardless.
>>
>> ideas?
>>
>> thanks
>>
>