File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Javascript Radio button controlled submit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Javascript Radio button controlled submit" Watch "Javascript Radio button controlled submit" New topic

Javascript Radio button controlled submit

Zein Nunna
Ranch Hand

Joined: Mar 31, 2005
Posts: 245
Hi guys,

I am trying achieve something quite simple, I am trying to enable a form submit button only when a radio button [that says something along the lines, I accept terms..] has been selected, my code is below, but for some reason it doesnt work

I've searched through numerous forums/posts and cant see what the problem is.

Any ideas? Your thoughts will be much appreicated.

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63542

Don't name anything "submit".

[Asking smart questions] [About Bear] [Books by Bear]
Liu Zhixiang
Ranch Hand

Joined: Aug 12, 2006
Posts: 32
use "onselect" is wrong.
you should use "onfocus" or "onclick"
[ August 14, 2006: Message edited by: Liu Zhixiang ]

I Think Therefore I Am
Zein Nunna
Ranch Hand

Joined: Mar 31, 2005
Posts: 245
Thank you very much guys,

Changed the button name from "submit" to "button123" and onSelect changed to onClick, and everything works like a charm.

It is sorta covered in the JavaRanch Style Guide.
subject: Javascript Radio button controlled submit
It's not a secret anymore!