Re: Dynamic refresh dropdown list

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

 



Hello,

on 07/17/2007 07:57 AM C.R.Vegelin said the following:
> I have a selection form with multiple dropdown lists, let's say A, B and C.
> If the dropdown list B is changed, then dropdown list C should be updated.
> To get this done, I use a small javascript
>     function reload(form)
>     {  var val=form.B.options[form.B.options.selectedIndex].value; 
>        self.location='myForm.php?B=' + val ;
>     }
> called by
>  <select id="B" name="B" onChange="reload(this.form);">
> 
> This works fine, BUT all other dropdown lists are also reset.
> So if I select another A, then another B, then also A is reset to its prior value.
> Any idea how I can refresh a specific dropdown, 
> without affecting all the other dropdowns ?

You seem to want linked select inputs. Take a look at this forms class.
It comes with a plug-in that does exactly what you want. It links select
inputs, so when the value of one input changes, the following input
switches the group of options without reloading the page. Here is a live
example that you can see in action:

http://www.meta-language.net/forms-examples.html?example=test_linked_select

There is are even variants of this plug-in that can retrieve a dynamic
set of options from a database. There are variants for MySQL or any
other database using Metabase or PEAR::MDB2 database abstraction API.

You can also watch a tutorial video here:

http://www.phpclasses.org/browse/video/1/package/1/section/plugin-linked-select.html

You can download the forms class from here:

http://www.phpclasses.org/formsgeneration

-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

-- 
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