[thelist] ajax dynamic dropdown menu set

Jack Timmons codeacula at codeacula.com
Wed Aug 4 10:52:36 CDT 2010


On Wed, Aug 4, 2010 at 10:11 AM, Bob Meetin <bobm at dottedi.biz> wrote:
> The echo statements are there just for testing.  Unfortunately this does not
> help.  The county variable which should be the row['id'] doesn't pass to
> getCity or findCity.php.  The script owner replied, "Getcity function
> expects 3 parameters but you're sending only two from the onchange action.
> send 3 and its fine. " but hasn't replied with further details how to ensure
> this happen.

Well, I got the moment to take a peek at it.

In findCounty.php, change line 11 from:

<select name="county" onchange="getCity(<?=$state?>,this.value)">

to:

<select name="county" onchange="getCity(<?php echo($country)?>, <?php
echo($state)?>, this.value)">

The Javascript function was expecting three variables, but your script
was only echoing out two. So, when you would select an element,
country was being passed as "undefined".

As a neat little trick, when you have issues like this, I usually pop
open Chrome's development window and see what the request was. After
that, it was a matter of tracking down where the Javascript was being
placed on the page from.

On Wed, Aug 4, 2010 at 10:43 AM, Bob Meetin <bobm at dottedi.biz> wrote:
> I like your domain name.  Long long ago when I was corporately employed we
> had a graveyard shift technician who was from Transylvania.  He was gaunt
> and looked the part.

Thanks :). It came to me in a moment of genius (I think an hour
earlier I had just finished surfing the bacula website, too).

Unfortunately (to some, who seem rather disappointed I'm not a cartoon
character), I'm not gaunt. I'm a tank of sexiness.

-- 
Jack Timmons
@_Codeacula


More information about the thelist mailing list