473,605 Members | 2,590 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="Goingo ut()">
</form>

<script>
function Goingout(){
if (document.formu lario.casilla.c hecked) 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 2292
In article <Gu**********@m ail.forum4desig ners.com>,
elhombrebala <Gu**********@m ail.forum4desig ners.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. earthlink.
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.demo n.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.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 20 '05 #3
elhombrebala <Gu**********@m ail.forum4desig ners.com> wrote in message news:<Gu******* ***@mail.forum4 designers.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
4071
by: TheKeith | last post by:
I am doing a form for my site and would like to enable and disable a radio button set depending on whether one of the choices on an outer radio button set is checked. How can I refer to all the inputs of the inner radio button set (they all share a common name) with javascript. I tried document.getElementsByNames('thename') but it doesn't work. I know this is because this method returns an array which you must then refer to by a specific...
1
1758
by: David | last post by:
Hi, I have an ASP page with a form and the following code: ..... type=Radio Checked name=selectserial value=" & RS("PSL_F_Serial")..... Tis will carry over the value of RS("PSL_F_Serial"), but I also have another value which needs to be carried (2 values per radio button), RS("PSL_L_Serial").
2
3135
by: Jeff | last post by:
I'm trying to create a dynamic form that can have multiple groups of radio buttons (each group has two buttons) with the same name. Essentially, the form allows a user to enter as many names as they want. If they need to add more, they click an "add name" button and the javascript inserts another row of input boxes. Each row should have two radio buttons to indicate sex (M F). When you have multiple text input boxes with the same...
3
2350
by: ewitkop90 | last post by:
Here is my code: <SCRIPT> function transportchange(transport) { if (framenewinstall.Helpdesk.checked) framenewinstall.Helpdesk.checked=false; if (framenewinstall.CircuitNumber.checked) framenewinstall.CircuitNumber.checked=false; switch (transport) { case 0: Helpdesk.innerText="No Info Needed";
2
16432
by: Mark Haase | last post by:
Hey All-- I'm rusty on my JavaScript but I'm pulling it back out to do a PHP/MySQL database application. I'm doing all the validation in PHP, but I'm using JavaScript to show/hide questions which depend on the responses to other questions, e.g. "If you answered yes to the previous question, then what time of day will you need your service activated?" One aspect of this is needing to be able to decide which radio button in certain...
1
8828
by: Jerry | last post by:
We have a 10-question quiz for kids, each question being a yes or no answer using radio selections. I'd like to keep a current total of yes's and no's at the bottom of the quiz (if the user selects yes to question 1, the total of yes's increases by 1). I've been searching for a while but I'm not sure I'm searching with the right keywords. Can anyone direct me to a source I can review to learn how to do this? Thanks! --
17
17034
by: Sam Kong | last post by:
Hello, There are 1 or more select elements with the same name in a form. Let's say that the name of the select is 'select1' and the name of the form is 'form1'. If there's only one select I access it like form1.select1. If there are more than one select, I access them like form1.select1. To check if there are more than one, I thought I can use
6
2059
by: dba | last post by:
using the following code with a problem.... echo "<input type='hidden' name='member_id' value=\"{$row}\">{$row}"; echo "<input type='radio' name='member_name' value=\"{$row}\">{$row}<br />"; The post_data.php program posts the following member id is: 0009
5
3592
by: mad.scientist.jr | last post by:
According to http://www.quirksmode.org/js/forms.html you need to look through a radio button's members to find the value: I tried writing a reusable function to return the value, see code at: http://www.geocities.com/usenet_daughter/javascript_radio.htm but for some reason I can only get a value if I hard code the control name.
0
7934
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8425
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8418
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8071
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
5886
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5445
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3912
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2438
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1271
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.