Give your Zip field an ID, then use $('#zip').value() instead of
form.ZIP.value.  Or maybe it's .value without parenthesis, I don't remember,
and I'm not in the mood to go look it up for you.  :)  But bottom line,
don't use 'form.ZIP'.  That's the part that isn't working.

On Sat, Jan 23, 2010 at 4:17 PM, Frank Becker
<computersac...@beckerwelt.de>wrote:

> Hi all,
>
> first of all I'm sorry if this posting is hard to read. English is not my
> mother tongue.
>
> I'm new to jQuery and jQuery-Autocomplete. I want to create an
> "intelligent" input form like
>
> Name: ____________
> ZIP: _______
> City: ____________
> Street: _____________
>
> If the ZIP-code is entered the city is filled automatically. That works.
> What I want is an autocompletion for street. In my database I have a list of
> all streets and the appropriate ZIP-codes
> e.g.
>
> 34128 / A-Road
> 34128 / B-Road
> 34128 / B-Street
> 34128 / C-Street
>
> If the ZIP-Code is 34128 and the first key pressed in the street-field is a
> "B", then only B-Road and B-Street should be shown in the autocomplete list.
>
> I have the following code fragment, taken from the demo (json.html) and
> adapted to fit my needs.
>
> $("#street").autocomplete('search.php?what=street&add='+$('#zip').val(), {
> ...
>
>
> search.php receives $_GET[q] the input of the user, in $_GET[what] what to
> search for (street, ZIP, ...) and in $_GET[add] is stored an additional
> parameter (ZIP in this case).
>
> The problem is, that I cannot send the value of the ZIP-code to search.php.
> I tried with the example above and with
>
> $("#street").autocomplete('search.php?what=street&add='+form.ZIP.value, {
> ...
>
> In this case, the additional parameter $add contains form.ZIP.value and not
> 34128.
>
> If I write
> $("#street").autocomplete('search.php?what=street&add=34128', { ...
>
> everything works fine.
>
>
> Thank you in advance for your help and hava a nice weekend.
> --
> Frank Becker
>
>


-- 
John Arrowwood
John (at) Irie (dash) Inc (dot) com
John (at) Arrowwood Photography (dot) com
John (at) Hanlons Razor (dot) com
--
http://www.irie-inc.com/
http://arrowwood.blogspot.com/

Reply via email to