That's actually not progress. The IPCE requires arrays, not JSON
Objects. You're seeing "[object Object]" because the outermost array
contains a series of objects. Your original PHP echo was correct, so
the place to look is in your Javascript that constructs the collection
editor.

Correct collection structure:
<?php  echo "[['12.00', '12.00'], ['24.00', '24.00'],
['36.00','36.00']]"; ?>

Each sub-array is used as the OPTION's value & display. To distinguish
things a little bit:
<?php  echo "[['12.00', 'Twelve'], ['24.00', 'Twenty-four'],
['36.00','Thirty-six']]"; ?>

You would end up with:
<select ...>
<option value="12.00">Twelve</option>
<option value="24.00">Twenty-four</option>
<option value="36.00">Thirty-six</option>
</select>

Let's see what your collection constructor looks like.
-joe t.


On Sep 6, 11:50 am, mlh <m...@free.fr> wrote:
> Hey,
>
> After a new attempt, whereI changed my PHP called page to :
>
> <?php  echo '[{"key":"Al", "value":"Alan"}, {"key":"Bi",
> "value":"Bill"}, {"key":"Ca", "value":"Carl"}, {"key":"Da",
> "value":"Dave"}, {"key":"Er", "value":"Erik"}, {"key":"Fr",
> "value":"Fran"}, {"key":"Ge", "value":"Gene"}]'; ?>
>
> I don't get the message "Loading options" in my select box anymore, but
> a list where all elements are called " [object Object] "...
>
> All option items look like this : <option value="[object
> Object]">[object Object]</option>
>
> I progress, but I'm still expecting a bit of help. Thanks a lot.
>
> Regards.
> Michel L'HUILLIER
>
> mlh a écrit :
>
> > Hey,
>
> > I have a small problem with Scriptaculous and InPlaceCollectionEditor :
>
> > I can use inline collections like this :
> >  var collection_1 = [['twelve', '12.00'], ['twenty-four.00', '24.00'],
> > ['thirty-six.00', '36.00']];
> >  var collection_2 = ['Alan', 'Bill', 'Carl', 'Dave', 'Erik', 'Fran',
> > 'Gene'];
> > Both work well !
>
> > But, when I want to use a distant collection, with the
> > loadCollectionURL, the doc is not as helpful as I wish...
> > It's only told that the answer has to be JSON...
> > I precise that my URL is OK.
>
> > I tried many things like this in the called page :
> > <?php  echo "var collection = ['bh', 'col', 'corb', 'dukes', 'house',
> > 'iow', 'ps']"; ?>
> > or this :
> > <?php  echo "[['12.00', '12.00'], ['24.00', '24.00'], ['36.00',
> > '36.00']]"; ?>...
> > but the only answer on my main page is  :
> > "Loading options" in the option box...
>
> > I use PHP, and just need to have an example of the syntax and the format
> > to use.
>
> > Did one of you encountered and solved this problem ?
>
> > Thanks for any help.
>
> > Michel L'HUILLIER
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to