473,221 Members | 2,334 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,221 software developers and data experts.

autofil a radio button

Jay
I have a form used to submit data (no surprises there!).
I'd like to be able to populate the same form with previously submitted
data.

The data lives in a database once submitted and using ASP I can populate
text boxes/textareas using this data no problem.
What about radio buttons?

If I have 2 of them named the same rb1 and rb1 with values of yes/no
respectively.
How can I check the one that was initially checked?

Cheers

J
Jul 23 '05 #1
4 3212
Jay wrote:
I have a form used to submit data (no surprises there!).
I'd like to be able to populate the same form with previously submitted
data.

The data lives in a database once submitted and using ASP I can populate
text boxes/textareas using this data no problem.
What about radio buttons?

If I have 2 of them named the same rb1 and rb1 with values of yes/no
respectively.
How can I check the one that was initially checked?


<input type="radio" checked>This one is checked
<input type="radio">This one is not checked.

--
Randy
Jul 23 '05 #2
Jay

"Randy Webb" <Hi************@aol.com> wrote in message
news:-I********************@comcast.com...
Jay wrote:
I have a form used to submit data (no surprises there!).
I'd like to be able to populate the same form with previously submitted
data.

The data lives in a database once submitted and using ASP I can populate
text boxes/textareas using this data no problem.
What about radio buttons?

If I have 2 of them named the same rb1 and rb1 with values of yes/no
respectively.
How can I check the one that was initially checked?
<input type="radio" checked>This one is checked
<input type="radio">This one is not checked.


Thanks Randy.
I know how to check a button but what I want to do is read the info from the
database and then populate a form based on those values.
For the text boxes I will use....(asp)
<input type = text name = "foo" value="<%=rs("BarValue")%>">
I'm not sure how to check a given radio button based on the info from the
database....

database contains the value "yes"
I have 2 radio buttons (values are "no" and "yes") therefore the form should
have "yes" checked as this was the value.
Next time it may be "no" in which case the radio button with the value of
"no" should be checked onLoad

Jay

--
Randy

Jul 23 '05 #3
Jay wrote:
"Randy Webb" <Hi************@aol.com> wrote in message
news:-I********************@comcast.com...
Jay wrote:
I have a form used to submit data (no surprises there!).
I'd like to be able to populate the same form with previously submitted
data.

The data lives in a database once submitted and using ASP I can populate
text boxes/textareas using this data no problem.
What about radio buttons?

If I have 2 of them named the same rb1 and rb1 with values of yes/no
respectively.
How can I check the one that was initially checked?


<input type="radio" checked>This one is checked
<input type="radio">This one is not checked.

Thanks Randy.
I know how to check a button but what I want to do is read the info from the
database and then populate a form based on those values.
For the text boxes I will use....(asp)
<input type = text name = "foo" value="<%=rs("BarValue")%>">
I'm not sure how to check a given radio button based on the info from the
database....

database contains the value "yes"
I have 2 radio buttons (values are "no" and "yes") therefore the form should
have "yes" checked as this was the value.
Next time it may be "no" in which case the radio button with the value of
"no" should be checked onLoad


Have ASP check the value of the Radio Button. Then check the appropriate
one.

Client-side, convert it to ASP:

if (radioButtonValue == "yes")
{
//ASP code to generate the Radio buttons with the Yes
//button checked
}
else
{
//ASP code to generate the Radio buttons with the No
//button checked
}

--
Randy
Jul 23 '05 #4
Jay wrote:
I know how to check a button but what I want to do is read the info from
the database and then populate a form based on those values.
For the text boxes I will use....(asp)
<input type = text name = "foo" value="<%=rs("BarValue")%>">
I'm not sure how to check a given radio button based on the info from the
database....

database contains the value "yes"
It should contain the (SQL) boolean values TRUE (and FALSE) instead.
I have 2 radio buttons (values are "no" and "yes") therefore the form
should have "yes" checked as this was the value.
Next time it may be "no" in which case the radio button with the value of
"no" should be checked onLoad


Child's play. Since you appear to use ASP:

<%@ LANGUAGE = JScript %>
...
<%
var bYesNo = rs("BarValue"); // using Boolean data
or
var bYesNo = (rs("BarValue") == "yes"); // using String data
%>
...
<input type="radio" name="foo"
value="Yes"<%= (bYesNo ? " checked" : "") %>>Yes
<input type="radio" name="foo"
value="No"<%= (!bYesNo ? " checked" : "") %>>No
HTH

PointedEars
Jul 23 '05 #5

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

Similar topics

4
by: Oscar Monteiro | last post by:
I Have to sets of Radio buttons like so: <input type="radio" name=p1 value=1> <input type="radio" name=p1 value=2> <input type="radio" name=p1 value=3> <br> <input type="radio" name=p2 value=1>...
5
by: Digital Puer | last post by:
I have the following HTML form: - radio button A (default selected) - radio button B - input field, of type "file" with "Choose" button - submit button I would like to have it so that if the...
3
by: John Davis | last post by:
I created a ASP.NET Web Form using VB.NET with a text box, 2 radio buttons. When the user click the first radio button, the text will change to uppercase. If the user clicks the other radio button,...
3
by: Amelyan | last post by:
When we want radio button to belong to a group name we say, radio1.GroupName="GroupA". In this case, radio1 will be unselected if another radio button is selected in "GroupA". Is there a way...
8
by: David Cameron | last post by:
I noticed that using an HTMLInputRadioButton and specifying a value to be an empty string (""), this is overridden by ASP.Net which set the value of the control to be the same as the ID of the...
9
by: IchBin | last post by:
I can not see what the problem is with this script. I am just trying to set a radio button by calling setCheckedValue('abbr_letter', 'V'). Sorry I am new to javascript. <html> <head> <script...
10
by: IchBin | last post by:
I am trying to set the state of a radio button. I do not see what I am doing wrong. Sorry, I am new at this.. I need another set of eyes to look at this snip of code. I am trying to set the radio...
65
by: Crayola465 | last post by:
Im trying to create an autofil for the city and state fields of my database by just entering a zip code. I have tried a few different things but it doesnt populate correctly. I haven't had to write...
8
by: photoboy | last post by:
I have racked by brain long enough on this, so now I need the help of someone who knows what they are doing. Here is what I am trying to achieve: First, I have two radio buttons (both unchecked)...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...

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.