Raimund
01-30-2002, 02:03 PM
Hi there,
I'd like JavaScript to display different options within a select box, depending on which button the user clicked.
Want more details? Here they come ... :D
I'm using ColdFusion and SQL Server to query a database and to dynamically display the results on our web page.
<CFQUERY NAME="test" DATASOURCE="#local_DBA#">
SELECT foo, bar
FROM testtable
WHERE (foo = 'true');
</CFQUERY>
<!-- this way, the database table 'testtable' is queried for the columns 'foo' and 'bar' such that the result variable (an array called 'test') may contain multiple entries when 'foo' was true. //-->
<FORM name=myform>
<SELECT name="selectbox" SIZE=10 multiple>
<CFOUTPUT QUERY="test">
<OPTION value="#bar#">
</CFOUTPUT>
</SELECT>
</FORM>
<!-- here the result is displayed within a select box, the <CFOUTPUT></CFOUTPUT>-block is necessary to access the ColdFusion array 'test'.
//-->
:confused: Now, I'd like to add two buttons and to fill in different query results into the SELECT box depending on which button the user clicked.
So, the question is, how do I exchange the value of the "test" array variable upon a button click? Is this possible with JavaScript?
Thanks a lot in advance & happy coding,
Rai. :)
I'd like JavaScript to display different options within a select box, depending on which button the user clicked.
Want more details? Here they come ... :D
I'm using ColdFusion and SQL Server to query a database and to dynamically display the results on our web page.
<CFQUERY NAME="test" DATASOURCE="#local_DBA#">
SELECT foo, bar
FROM testtable
WHERE (foo = 'true');
</CFQUERY>
<!-- this way, the database table 'testtable' is queried for the columns 'foo' and 'bar' such that the result variable (an array called 'test') may contain multiple entries when 'foo' was true. //-->
<FORM name=myform>
<SELECT name="selectbox" SIZE=10 multiple>
<CFOUTPUT QUERY="test">
<OPTION value="#bar#">
</CFOUTPUT>
</SELECT>
</FORM>
<!-- here the result is displayed within a select box, the <CFOUTPUT></CFOUTPUT>-block is necessary to access the ColdFusion array 'test'.
//-->
:confused: Now, I'd like to add two buttons and to fill in different query results into the SELECT box depending on which button the user clicked.
So, the question is, how do I exchange the value of the "test" array variable upon a button click? Is this possible with JavaScript?
Thanks a lot in advance & happy coding,
Rai. :)



