470,617 Members | 1,977 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,617 developers. It's quick & easy.

Multiple radio inputs


With this script I can force the user to select the checkbox befor
continuing, but now I have a menu with lots of radio unputs and I woul
like the user to select at least 2 of them; how can I check it?

<form name=formulario>
<INPUT type=checkbox name=casilla>
<INPUT type=button value="Salir"
onclick="Goingout()">
</form>

<script>
function Goingout(){
if (document.formulario.casilla.checked) window.close()
else alert("Select this option to continue")
}
</script

elhombrebala
-----------------------------------------------------------------------
Posted via http://www.forum4designers.co
-----------------------------------------------------------------------
View this thread: http://www.forum4designers.com/message33852.htm

Jul 20 '05 #1
3 2140
In article <Gu**********@mail.forum4designers.com>,
elhombrebala <Gu**********@mail.forum4designers.com> wrote:
With this script I can force the user to select the checkbox before
continuing, but now I have a menu with lots of radio unputs and I would
like the user to select at least 2 of them; how can I check it?


<input type="radio" name="BFMS" value="10">

....

if (document.forms[0].BFMS.checked == true)
A hint.

Robert
Jul 20 '05 #2
JRS: In article <rc*****************************@news05.west.earth link.
net>, seen in news:comp.lang.javascript, Robert <rc*******@my-deja.com>
posted at Sat, 7 Feb 2004 03:56:20 :-

if (document.forms[0].BFMS.checked == true)


AFAICS, the == true serves no useful purpose.

<URL:http://www.merlyn.demon.co.uk/js-other.ht#PF> #7

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 20 '05 #3
elhombrebala <Gu**********@mail.forum4designers.com> wrote in message news:<Gu**********@mail.forum4designers.com>...
With this script I can force the user to select the checkbox before
continuing, but now I have a menu with lots of radio unputs and I would
like the user to select at least 2 of them; how can I check it?


The typical or intended use of radio buttons is like on an old car
radio. You put of a group of radio buttons and you are only allowed
to select on radio button from the group. You make a group by naming
all the radio buttons the same. This creates an array of radio
buttons with the same name and you use array indexing to access.

The general idea of check boxes are for making none, one, or more than
one selection from the group.

In you case, your want to force the user to make at least two
selections. Checkboxes are for this.

Now, if you have two groupings of radio buttons and you want the user
to fill have selected a radio button from both this would make sense.
I use ( ) to indicate a radio button.

Example:
Pick a color:
( ) red
( ) green
( ) yellow

Pick a style of finish:
( ) wood
( ) metal
( ) plastic

....
If I understand what you are proposing, you could be could be
producing a confusing panel for the user. Try to go with the intend
of radio and check boxes.

I hope my minimalistic example was helpful.

Robert

PS. == true is easier for me to read. I guess that I could get
confused over datatypes, but other than that I do not see a problem.
I guess it could be confusing to a reader who doesn't use == true.
Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Mark Haase | last post: by
1 post views Thread by Jerry | last post: by
17 posts views Thread by Sam Kong | last post: by
5 posts views Thread by mad.scientist.jr | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.