Excellent, Both solutions worked great! Thanks a lot for your help
On Oct 16, 3:26 pm, adexcube <[EMAIL PROTECTED]> wrote: > Hi, have you tried something like this? > > $("input:text").focus( function() { alert($ > (this).attr("name")); } ).autocomplete("server.php", { > extraParams: { > fieldname: function() { return $(this).attr("name"); } > } > }); > > I hope this helps > > Cheers > > On Oct 16, 1:59 pm, The Hamburgler <[EMAIL PROTECTED]> wrote: > > > Hi, > > > I wish topassan extra parameter to theAutocompletequeryURLthat > > will determine thenameof the current input field. TheURLwill then > > know what field is requesting the data and can return the relevant > > data. > > E.g. It could be list of countries or a group of surnames already in > > the database. > > > I have read the documentation and thought the extraParams option would > > do this but i'm struggling with the correct syntax. > > > The example below willpassan undefined value for 'fieldname' as $ > > (this) is out of scope within the extraParams function. Is there a way > > I can access the inputs fieldnamedynamically so i don't have to bind > > theautocompletefunction to each individual input? > > > $(".autocomlete").autocomplete(url, { > > extraParams: { > > fieldname: function() { return $(this).attr("name"); } > > } > > > }); > > >http://docs.jquery.com/Plugins/Autocomplete > > > Thanks for your time.