JRS: In article <il*****************@news-server.bigpond.net.au>, dated
Tue, 29 Nov 2005 13:04:14 local, seen in news:comp.lang.javascript,
Blinky <xx***********@bigpond.net.au> posted :
I have a dynamically generated page that can have 1 or more radio buttons. I
am using javascript with onsubmit in the form statement to make sure a radio
button is selected before allowing the page to be submitted. At the moment
it only works when there is 2 or more radio buttons on the page.
So you need to change your validation code.
How can I get the radio button validation working when there is only 1 radio
on the page ?
With dynamic material, you may legitimately have only one line of the
button-deserving type. If you count them before you generate them, you
can omit the button if there's only one line.
Alternatively, you can have a permanent Button Zero, selected by
default, labelled "none of them"; and validate by checking that it is
cleared.
But your code is wrong.
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of 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.