On Dec 9, 11:31 pm, tumba <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm trying to have a multiple input text fields with a name "name[]"
> so that I will be able to process them as an array with PHP and Insert
> them in Mysql.
>
> But as soon as I use the bracket, the autocompleter stops working. Is
> there any way to go around it?
>
> document.observe('dom:loaded', function() {
> new Ajax.Autocompleter('name[]', 'name_suggestions','auto.php',{tokens:
> [',']});});

The first argument to Ajax.Autocompleter must be the object ID, not
its name: HTML id's must be unique in the document, and may not
contain '[' or ']'. The 'name' attribute (which is significant for a
form element) may be any character data, and is where some systems
treat '[]' specially.

I'm not certain but I think if you define your input element as
<input type = "text" id = "name" name = "name[]" ... >
and then
new Ajax.Autocomplete('name', ... )
it will work.

> Also, I want to make sure that the value that the user types into the
> text field exists in my Mysql database. So the user can only write a
> value that matches a value in the database. So when a value that
> matches a value in the database is written, how can I catch that?
> Should this happen in my auto.php file?

Yes. The whole point of using an autocompleter is that your back-end
code should do the DB access and return only the values *in the
database* which match what the user has so far typed.

Colin

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to