Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Radio Buttons and Text Boxes

Status
Not open for further replies.

GWPhoenix

IS-IT--Management
Jun 26, 2001
32
US
I am trying to populate some questionnaires with the following code. Some of the answers will be in text boxes, the others will be using Yes/No Radio Buttons.



The code for the output table of questions is as follows:

Response.Write &quot;<table>&quot;
do until rst.EOF
Response.Write &quot;<tr>&quot;
'Insert the Question Being Asked Response.Write &quot;<th align='left'>&quot; & rst(&quot;Question&quot;) & &quot;</th>&quot;

'Choice of answers. DataTypeID = 4 is the yes/no radio buttons

If rst(&quot;DataTypeID&quot;) = 4 then
Response.Write &quot;<td>&quot;
Response.Write &quot;<INPUT type='radio' name= 'Answer' CHECKED Value = 'Yes'>&quot; & &quot; Yes   &quot;
Response.Write &quot;<INPUT type='radio' name= 'Answer' Value = 'No'>&quot; & &quot; No&quot;
Response.Write &quot;</td>&quot;
Else
'Regular text box answer
Response.Write &quot;<td>&quot; & &quot;<input type='text' name='Answer&quot; & trim(rst(&quot;QuestionID&quot;)) & &quot;'>&quot; & &quot;</td>&quot;
End if

Response.Write &quot;</tr>&quot;
rst.MoveNext
loop
. . . etc.

The text box answers work fine.

Right now the Yes/No radio buttons show up, but if I click an answer in one button on a page, the answer disappears from another question. What am I doing wrong?
 
By default radio buttons only allow one to be checked. If you want to have multiples you either have to name them diffrently or you could use checkboxes.

Roj
 
Are you talking about naming them differently for each question? How could I do that?

What I am trying to do is fill out a form (per page) where if it is a yes/no answer, it can be answered through the radio buttons. Checkboxes allow both yes and no to be answered simultaneously.
 
GW
Yep...that's what yandso was saying. Each &quot;pair&quot; of radio buttons has to have the same name but subsequent sets would need to be named differently. So
<INPUT type='radio' name= 'Answer' Value = 'No'>
would need to be changed for each set of radio buttons. Maybe as simple as answer1, answer2 or perhaps question1, question2 etc.
hth
mb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top