473,395 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Radio Button and Combo Box Dynamic Data Retrieval

Hi,

May I know how to create data dynamically in a combo box after
clicking on a radio button ? Data are retrieved using a store
procedure from a SQL Server.

For example :
Click Radio Button 1, the combo box should contains "A", "B", "C"
Click Radio Button 2, the combo box should contains "E", "F", "G"

The data can change dynamically after getting results from SQL Server.

Please shed some lights to me. I have been trying to find a solution
to this for a the past few days.

Thanks.
Jul 19 '05 #1
1 4092
Hi David,

Okay, first you need to be able to submit the form after clicking
on a particular radio button. You can accomplish this using:

<form name="theform" method="post" action="form.asp">

<input type="radio" name="selection_button" value="Option1"
onFocus="this.checked=true; this.submit()" >Option 1<br/>
<input type="radio" name="selection_button" value="Option2"
onFocus="this.checked=true; this.submit()">Option 2<br/>

</form>

The form should submit to itself where you would check to see
if option1 or option2 has been selected and then call the
appropriate SQL statement and store the results in a
recordset i.e.

<%

Selected_Option = Request.Form("selection_button")

If Selection_Option="option1" Then Call SQL_Function1() End If

If Selection_Option="option2" Then Call SQL_Function2() End If

%>

In the form at the top of this page you'll need to add the following
to populate the drop down list, assuming the record set is called
rs

<% If Selection_Option<>"" Then %>

<select name="combo_box">

<%
Do While Not rs.EOF
%>

<option
value="<%=rs.Fields("field_name").Value%>"><%=rs.F ields("field_name").Value%
</option>
<%
rs.MoveNext
Loop
%>
</select>

<% End If %>

I'm in a hurry so the code above may contain mistakes - but you
should get the general idea. There's probably dozens of methods
to accomplish this. Let me know if you have any problems.

Dominic

"David" <da*****@rocketmail.com> wrote in message
news:44**************************@posting.google.c om... Hi,

May I know how to create data dynamically in a combo box after
clicking on a radio button ? Data are retrieved using a store
procedure from a SQL Server.

For example :
Click Radio Button 1, the combo box should contains "A", "B", "C"
Click Radio Button 2, the combo box should contains "E", "F", "G"

The data can change dynamically after getting results from SQL Server.

Please shed some lights to me. I have been trying to find a solution
to this for a the past few days.

Thanks.

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Craig Keightley | last post by:
I have a page that has n number of radio groups (yes/No) how can i prevent the form being submitted if more than one radio group is not selected? By default all radio groups are unchecked ...
14
by: Steve Chatham | last post by:
I have a combo box that gets populated with a group of items based on a sql table. I had in mind that I'd insert a value at the beginning of that combo box, that'd say "No Item Selected" and...
2
by: NishSF | last post by:
Would anyone have any suggestions/javascript code so that if one clicks the Radio Button "Yes" below he has the option of selecting any of the six CheckBox below. If the user clicks on Radio Button...
22
by: Saul | last post by:
I have a set of radio buttons that are created dynamically, after rendered I try loop thru this set by getting the length of the set, but I keep getting an error stating the element is undefined. I...
2
by: Eric Layman | last post by:
Hi, I have a radio button and a combo box. Upon changing a value for radio button, the combo box values will be dynamically updated. I have an idea on how to go abt doing it but Im stuck...
3
by: Eric | last post by:
Hi. I have this Combobox name 'Origin' that contains all states and countries. I would like to create two Radio buttons (State and Country) that when you select State, the combobox will query only...
0
by: LavanyaM | last post by:
Hi, In our app we need to create dynamic radio buttons. There should be three radio buttons and this set is dynamic accroding to the data this is my code: <th width="5%"...
12
by: ive1122 | last post by:
Hi guys, I am looking into create a dynamic survey as posted in Get User Input From Dynamic Controls but with some different environment Below is what i am trying to do: First when the user...
8
by: SachinPatel | last post by:
ChipR, Good news i have figured the radio button issues out with some SQL and some VBA functions. Thanks for you support. I am still trying to diaplay all macthing types in the list box...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.