Ajax AutoComplete Support Product Page

Answered

Using AutoComplete with cloned form elements

Asked 21 Jan 2012 10:53:58
1
has this question
21 Jan 2012 10:53:58 Iain Sutherland posted:
I am using jQuery to clone the input fields on a short form. The cloning appears to work correctly but the AutoComplete works only for first occurance of the input and not for any subsequent clones.

Any suggestions appreciated

Promoted Answers

Replied 23 Jan 2012 13:24:49
Hello Iain,

It is much more difficult to create a cloned fields with Autocomplete assigned to each because for each you need different settings in the script tag that follows the input and you need ( if different data is to be get from the MySQL or whatever source you use ) a different server side file (like autocomplete-quote11-php-2.php )for each field.

Regards.

Replies

Replied 21 Jan 2012 15:12:33
21 Jan 2012 15:12:33 Iain Sutherland replied:
In case it helps anyone else I came up with an interim working option using the following onFocus action to fire the autocomplete and ignore the actual clone name:

onFocus="jQuery(this).autocomplete('autocomplete-quote11-php-2.php',
{
opacity : .7,
delay : 100,
minChars : 3,
matchContains : true,
fxShow : { type:'slide' },
fxHide : { type:'slide' }

});" />

I still have to work out how to retreive the data though.
Replied 23 Jan 2012 13:24:49
23 Jan 2012 13:24:49 Miroslav Zografski replied:
Hello Iain,

It is much more difficult to create a cloned fields with Autocomplete assigned to each because for each you need different settings in the script tag that follows the input and you need ( if different data is to be get from the MySQL or whatever source you use ) a different server side file (like autocomplete-quote11-php-2.php )for each field.

Regards.
Replied 23 Jan 2012 20:18:14
23 Jan 2012 20:18:14 Iain Sutherland replied:
Miro, thanks for coming back so soon. The clone fields were all based on the same data set and I managed to increment them as an array (name[]) so they are all sequenced children in the array. Seems to work as required for now.

Reply to this topic