W
Ward
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.writing
<head>
...
function showlinks() {
if (hoofdregio =='ASSE') {
opt('xxx','Allemaal');
opt('yyy','ASSE');
opt('zzz','BRU');}
if (hoofdregio =='BKH') {
opt('xxx','Allemaal');
...
}
</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="return load
(document.subregios.subregio)">');
document.write('<SELECT NAME="subregio">');
document.write('<OPTION SELECTED>Allemaal<\/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>allemaal</option>
<script>showlinks();</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.writing
<head>
...
function showlinks() {
if (hoofdregio =='ASSE') {
opt('xxx','Allemaal');
opt('yyy','ASSE');
opt('zzz','BRU');}
if (hoofdregio =='BKH') {
opt('xxx','Allemaal');
...
}
</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="return load
(document.subregios.subregio)">');
document.write('<SELECT NAME="subregio">');
document.write('<OPTION SELECTED>Allemaal<\/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>allemaal</option>
<script>showlinks();</script>
</select>
Any ideas ?
thx
Ward