File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes test not working well for radio button when I have 1 element of list Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "test not working well for radio button when I have 1 element of list" Watch "test not working well for radio button when I have 1 element of list" New topic
Author

test not working well for radio button when I have 1 element of list

Kyupa Supa
Ranch Hand

Joined: Jun 23, 2012
Posts: 30
A list of courses is displayed and user has to select 1, so I used radio buttons. The course list vary from one student to another.

If I have more than 1 courses displayed and user selects one, everything is ok, but if I display 1 course, the test is JavaScript seems to not be right...

Validate if radio button(a course) was checked:



If I have 1 course, ok = 1 (due to textbox(es) only, ignoring the selected course). ok = 2 so the form will be submitted
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
The way way back machine has a solution: http://www.coderanch.com/t/115796/HTML-CSS-JavaScript/inconsistency-radiobutton

Eric
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61010
    
  65

Or use jQuery and forget about inconsistencies.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: test not working well for radio button when I have 1 element of list