On Thursday 09 February 2006 15:13, Sebastian Kurt wrote:
> Hi,
>   I'm using PHP to fill my parameterlist for Autocompleter.Local as
> shown in the example
> (http://wiki.script.aculo.us/scriptaculous/show/Autocompleter.Local).
>
> <script type="text/javascript">
> new Autocompleter.Local('recipeNameAlternative', 'rezept_list', [
> <?php $ende = count($rezept_vorgabe);
>   for ($i=0;$i<$ende;$i++) {
>       echo '\''.$rezept_vorgabe[$i].'\'';
>       if($i != $ende-1) {
>               echo ",";
>       }
>   } ?>
> ], {});
> </script>
>
> If the content of $rezept_vorgabe is over 30 elements long, my
> JavaScript-Console returns the error "missing ] after element list".
> AutoCompletion will not work!?

something is probably wrong with one of the elements in the list.

instead of blindly writing out the array, you might want to find a php JSON 
module or extension or function or whatever, and you just generate an array, 
convert it to json, and drop it in there.  Then you can be certain (unless 
the JSON creation is buggy) that the array will work.

I currently use the perl JSON module for a similar function, and I often have 
thousands of elements in the array without problems.

If you aren't down for that, then I am with Todd that we need to see the 
output of the php code you have shown us.  I'm not good enough with php to be 
able to think of an example where your code would produce broken javascript, 
but I'm almost certain that's what's happening.

-Jeremy

-- 
Jeremy Kitchen ++ [EMAIL PROTECTED]

In the beginning was The Word and The Word was Content-type: text/plain
  -- The Word of Bob.

Attachment: pgpA7JcXslERm.pgp
Description: PGP signature

_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to