By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,480 Members | 1,743 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,480 IT Pros & Developers. It's quick & easy.

Re: Taking action only when two sets of radio buttons have both been selected

P: n/a
In comp.lang.javascript message <d4**********@hotpop.com>, Fri, 18 Jul
2008 23:23:13, Lasse Reichstein Holst Nielsen <lr*@hotpop.composted:
>Steve Swift <St***********@gmail.comwrites:
>I have a page with two sets of radio buttons. I'd like to take an
action only when both sets of radio buttons have a selected button.

So you need to either remember or compute whether each group has
a button selected.
Not necessarily.

If each set of radio buttons has an additional default hidden button,
then it is only necessary to test that said button is not selected to
determine that one of the others has been selected.

Alternatively, that default button can be non-hidden but labelled
something like "I'm still thinking about this question"; then if the
user makes a selection and realises that it was too hasty he can un-make
it and be protected against sending the hasty answer.

I don't believe that the E-mail address in the sig of the quoted LRN
article actually works. Amusingly, the Google translation of "oversat
til dansk" appears to be "translated into English".

--
(c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
Web <URL:http://www.merlyn.demon.co.uk/- FAQqish topics, acronyms & links;
Astro stuff via astron-1.htm, gravity0.htm ; quotings.htm, pascal.htm, etc.
No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.
Jul 19 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Dr J R Stockton wrote:
If each set of radio buttons has an additional default hidden button,
then it is only necessary to test that said button is not selected to
determine that one of the others has been selected.
Thank you, that would make my test quite simple. The page itself is
built by a CGI script, so I don't need to know enough Javascript to loop
over all the sets of radio buttons in the page - the CGI script can
generate a longer JavaScript clause when there are more sets.

--
Steve Swift
http://www.swiftys.org.uk/swifty.html
http://www.ringers.org.uk
Jul 20 '08 #2

P: n/a
Steve Swift wrote:
Thank you, that would make my test quite simple.
Indeed, very simple. My test page at http://swiftys.org.uk/buttons.html
is now working. Thank you.

That page is static HTML, but the production page will be generated by a
CGI script which can extend the "if" statements according to the number
of buttons in each group.

I'm actually not expecting there ever to be more than one group, but it
might occur very occasionally.

--
Steve Swift
http://www.swiftys.org.uk/swifty.html
http://www.ringers.org.uk
Jul 20 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.