Radiobutton validation.
Posted
by _sh
on Stack Overflow
See other posts from Stack Overflow
or by _sh
Published on 2009-09-03T13:01:21Z
Indexed on
2010/04/22
18:03 UTC
Read the original article
Hit count: 126
JavaScript
|jsp
The question is on the client side validation using java script.
Significant parts of the program related to the question are given below..
...
<form name="results" action="" method="post">
...
<input type="radio" name="id" value="<%= id_edit %>" /> <!-- Don't bother about id_edit -->
....
<input type="button" name="Edit" value="Edit" onclick="invoke(0)"><input type="button" name="Delete" value="Delete" onclick="return invoke(1)">
....
The script,
function invoke(btn)
{
if(btn == 0) document.results.action="gev.do";
if(btn == 1) document.results.action="del.do";
document.results.submit();
}
What basically i do is, depending on the selection of button, i pass a value to the servlet, either for updation or deletion.
My question is, how can i validate the radiobutton, ie, i can any one help me out writing the js to validate if any one of the radio button is selected.
All my efforts are in vein and i now use server side validation.
© Stack Overflow or respective owner