Click to See Complete Forum and Search --> : Dynamically select Radio Button Value


ASPDEV
05-16-2005, 03:48 PM
I have a drop down list with the following values:

1) HONDA
2) TOYOTA
3) NISSAN

The above values are in the database:
The table looks like this:
CAR Value
HONDA YES
TOYOTA NO
NISSAN NO

I have 2 radio buttons "Yes" and "No"

I populate the drop down list from the database:
SELECT CAR FROM TABLE_CAR

So far so good....
Now when the user selects for example HONDA from the drop down list...I want to dynamically check its corresponding value
which would be "YES" from the database....and check the "YES" radio button...
IF the user selects TOYOTA then I want to check the "NO" radio button...

Not sure how to do this....
Could anyone please help me...

Illufox
05-16-2005, 04:41 PM
I've used something similar for a web application I wrote a while back. You may be able to adjust this for your application:

<input <%If "Select" = CStr (CStr((Recordset1.Fields.Item("Honda").Value)) Then Response.Write("checked") : Response.Write("")%> type="radio" name="Honda" value=Yes >

ASPDEV
05-16-2005, 05:17 PM
Thanks for your response...
But it still does not work...

what I was trying to do is select the values from the database:

So I have One drop down with the first columns viz; HONDA, TOYOTA, NISSAN
and 2 radio buttons..

Initially i retevive vales for the user..

so for example:
I have HONDA and the radio button YES is checked...

Now the user wishes to change this selection..
so he selects NISSAN...now onchange of this select box I need to dynamically change the radiobutton value...so YES would get deselected and NO would get selected...

Now onchange of the select box i was reloading the form...
so now i have the value the user selected....
thenby request.form i get the value for this and pass it to select query..
select value from table_car where car='NISSAN'

now get the value as "NO" from database...
but the NO radio button is not getting checked....

what should I do...

wmif
05-16-2005, 05:30 PM
you will need javascript to accomplish that task.

buntine
05-16-2005, 08:42 PM
To clarify, it cannot be done dynamically because ASP can only run from the server. You can, however, use a postback to reload the page.

Regards.