/    Sign up×
Community /Pin to ProfileBookmark

radio buttons or check boxes???

Hello all,
I have to develop a usability survey for a website. Some of the questions are supposed to allow the user to choose more then one answer thus calling for checkboxes. Other questions are allowed only one answer, requiring radio buttons, correct? This is the dilemma – we want the survey to appear consistent, instead of every other question being a radio button. Is there a way to use checkboxes but, with certain questions, only allow one selection? Or, is there a way to allow more then one radio button to be checked off? If neither is possible, any ideas on how I develop a consistent looking survey?

Thank you all for suggestions.

to post a comment
JavaScript

9 Comments(s)

Copy linkTweet thisAlerts:
@Zach_ElfersDec 04.2002 — The only way radio buttons are only able to have one check is because the sets all have the same name:

<input type="radio" name="radioset">

<input type="radio" name="radioset">

<input type="radio" name="radioset">

In the above example, you would only be able to check ONE of the radio buttons because they all have the same name. If you want the user to be able to check more then one:

<input type="radio" name="1">

<input type="radio" name="2">

<input type="radio" name="3">

?
Copy linkTweet thisAlerts:
@SotiauthorDec 04.2002 — Thank, Zach, for your reply. I know that with a different names radio buttons will allow more then one to be selected. But that would throw our db off, all of the selections for question 1 would have to have the same name, thus not allowing more then one radio button to be checked.

It there a way, possibly with check boxes, that would

[B]not[/B] allow a user to select more then one for a given question. Even if that means an alert appearing when the user makes the second selection, asking the user to make only one selection and, if possible, deleting the second selection that was made. (sorry for the runon)

Thanks, again, I appreciate the help!
Copy linkTweet thisAlerts:
@Zach_ElfersDec 04.2002 — I guess you'll have to use checkboxes then because I don't think that is possible with radio buttons. You might also be able to edit your script to work with radio buttons, but that might be a lot of work.
Copy linkTweet thisAlerts:
@SotiauthorDec 04.2002 — Any ideas on how to accomplish this with check boxes?
Copy linkTweet thisAlerts:
@Zach_ElfersDec 04.2002 — You might just substitute checkboxes for radio buttons. Instead of <input type="radio" change it to <input type="checkbox". I don't know if that is what you are looking for though.
Copy linkTweet thisAlerts:
@SotiauthorDec 04.2002 — No, because then users will always be able to check more then one. There are about three questions in which I want the user to make only one selection. And it has to look consistent, either all check boxes or all radio buttons.

err ?
Copy linkTweet thisAlerts:
@SotiauthorDec 04.2002 — Okay, it's something like this, now if only I could get it working in Netscape...:

<html>

<heaD>

<script language="JavaScript">

<!--

function checkOne(elem){

var nm = elem.name;

var cnt = document.getElementsByName(nm).length;

for(var i = 0;i<cnt;i++){

document.getElementsByName(nm)[i].checked=false;

}

elem.checked = true;

}

//-->

</script>

</head>

<body>

Only Select One:<br>

Yes <input type="checkbox" name="group_1" onClick="checkOne(this);"><br>

No <input type="checkbox" name="group_1" onClick="checkOne(this);"><br>

Maybe <input type="checkbox" name="group_1" onClick="checkOne(this);"><br>

<br>

Select All That Apply:<br>

Blue <input type="checkbox" name="group_color"><br>

Red <input type="checkbox" name="group_color"><br>

Purple <input type="checkbox" name="group_color"><br>

<br>

</body>

</html>
Copy linkTweet thisAlerts:
@gil_davisDec 04.2002 — [i]Originally posted by Soti [/i]

[B]now if only I could get it working in Netscape...:[/B][/QUOTE]


Enclose the form elements in a <FORM></FORM> tag (like you are supposed to), and Netscape will work.
Copy linkTweet thisAlerts:
@SotiauthorDec 04.2002 — yes, of course ?
×

Success!

Help @Soti spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...