I need to validate radio buttons using an alert box. It also needs to work in conjunction with another validation how is this done? How do you validate a radio button? How do you validate?
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
I need to validate radio buttons using an alert box. It also needs to work in conjunction with another validation how is this done? How do you validate a radio button? How do you validate?
Validating might be as simple as asking the user, "Are you sure?" with OK/Cancel buttons to more complicated verifications to determine that the choice is "legal" and executable according to program logic and what could happen next.
In my experience, radio buttons are typically low-level logic, not by themselves causing significant things to happen, so I'm curious why validation is even required. Perhaps you could give more detail.
learning2code (December 17th, 2013)
Validation is required to ensure that a radio buttons have been selected and that the selected button is the correct one.
There are methods available to determine if a radio button has been selected. Look at both the radio button and button group classes to find the method you need for that part. As for the second part, to determine if the selected button is correct, that would involve whatever logic is required to determine correctness, something you haven't explained. Frankly, give the user a break and gray out radio buttons that aren't "correctly" selectable.
Greg, this is about javascript. See the OP's other thread.
Ahhh. Thanks.
syntax to create radiobutton when you using applet
CheckBoxGroup x=new CheckBoxGroup();
add(new Checkbox("male",x,true);