Re: Using Ajax to populate a drop-down list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



on 08/08/2008 12:58 AM Don said the following:
Hi,

I have a form with two lists. One is populated with many options while the second is populated with only a single item. When the first drop-down list is changed, I call a PHP script sing AJAX to populate the second list. I also need to perform another task when the second list is changed but it seems not to work.

I think this is because even though my AJAX script populates the second drop-down list using pure PHP code, the second drop-down isn't aware of it. I've tries adding JavaScript code in the AJAX route to add options to the list but it's not working.

Does anyone have an example of how to do this?


Don:

As I understand your problem, there's no need to let the server-side know anything until after the user has selected their choice from the drop-downs. You can do everything client-side via javascript and not use AJAX at all.

Here's an example of populating drop-downs using just javascript:

http://www.webbytedd.com/b/dyn-select/

It's a simple matter to put in a submit button and pass the user's selections on to a waiting php script.

I think using Ajax here is over complicating your problem.

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux