Hi,
Consider a window with 2 linked dropdownboxes, dynamically
fed from a dbase.
One technique to implement this would be to use an onchange
event on the first box, then have the script call itself again,
this time with a GET variable, calling the db for a 2nd time to
populate the 2nd dropdownbox. (using PHP)
That's fine when you have a local connection to a db, as you have
little connection-setup-costs, and only minor image flicker.
I'm not, so I'm trying to do this :
My PHPscript calls the db ONCE, then it writes the <options> for
the second dropdownbox in a javascript function 'showlinks'.
The opt function does the actual document.writin g
<head>
...
function showlinks() {
if (hoofdregio =='ASSE') {
opt('xxx','Alle maal');
opt('yyy','ASSE ');
opt('zzz','BRU' );}
if (hoofdregio =='BKH') {
opt('xxx','Alle maal');
...
}
</head>
My problem is that for this to work, creating the 2nd dropdownbox
has to be done in javascript completely like so :
document.write( '<FORM NAME="subregios "' + 'onSubmit="retu rn load
(document.subre gios.subregio)" >');
document.write( '<SELECT NAME="subregio" >');
document.write( '<OPTION SELECTED>Allema al<\/option>');
showlinks();
document.write( '<\/SELECT>');
document.write( '<INPUT TYPE="SUBMIT" VALUE="Go">');
document.write( '<\/FORM>');
What I would like to do is this :
<select name="subregio" >
<option selected>allema al</option>
<script>showlin ks();</script>
</select>
Any ideas ?
thx
Ward
Consider a window with 2 linked dropdownboxes, dynamically
fed from a dbase.
One technique to implement this would be to use an onchange
event on the first box, then have the script call itself again,
this time with a GET variable, calling the db for a 2nd time to
populate the 2nd dropdownbox. (using PHP)
That's fine when you have a local connection to a db, as you have
little connection-setup-costs, and only minor image flicker.
I'm not, so I'm trying to do this :
My PHPscript calls the db ONCE, then it writes the <options> for
the second dropdownbox in a javascript function 'showlinks'.
The opt function does the actual document.writin g
<head>
...
function showlinks() {
if (hoofdregio =='ASSE') {
opt('xxx','Alle maal');
opt('yyy','ASSE ');
opt('zzz','BRU' );}
if (hoofdregio =='BKH') {
opt('xxx','Alle maal');
...
}
</head>
My problem is that for this to work, creating the 2nd dropdownbox
has to be done in javascript completely like so :
document.write( '<FORM NAME="subregios "' + 'onSubmit="retu rn load
(document.subre gios.subregio)" >');
document.write( '<SELECT NAME="subregio" >');
document.write( '<OPTION SELECTED>Allema al<\/option>');
showlinks();
document.write( '<\/SELECT>');
document.write( '<INPUT TYPE="SUBMIT" VALUE="Go">');
document.write( '<\/FORM>');
What I would like to do is this :
<select name="subregio" >
<option selected>allema al</option>
<script>showlin ks();</script>
</select>
Any ideas ?
thx
Ward
Comment