Click here to Skip to main content
15,912,756 members
Home / Discussions / JavaScript
   

JavaScript

 
QuestionHow to write confirmation message? Pin
Member 1062605710-Mar-14 0:08
Member 1062605710-Mar-14 0:08 
AnswerRe: How to write confirmation message? Pin
thatraja10-Mar-14 2:29
professionalthatraja10-Mar-14 2:29 
GeneralRe: How to write confirmation message? Pin
Member 1062605710-Mar-14 2:45
Member 1062605710-Mar-14 2:45 
GeneralRe: How to write confirmation message? Pin
thatraja10-Mar-14 2:59
professionalthatraja10-Mar-14 2:59 
GeneralRe: How to write confirmation message? Pin
Praneet Nadkar4-May-14 23:22
Praneet Nadkar4-May-14 23:22 
GeneralRe: How to write confirmation message? Pin
thatraja4-May-14 23:28
professionalthatraja4-May-14 23:28 
GeneralRe: How to write confirmation message? Pin
Praneet Nadkar4-May-14 23:40
Praneet Nadkar4-May-14 23:40 
AnswerRe: How to write confirmation message? Pin
Praneet Nadkar4-May-14 23:39
Praneet Nadkar4-May-14 23:39 
Questionconsume external WCF REST services using Angular.js Pin
ramsai19737-Mar-14 1:14
ramsai19737-Mar-14 1:14 
AnswerRe: consume external WCF REST services using Angular.js Pin
Jellali Tarek7-Mar-14 4:38
Jellali Tarek7-Mar-14 4:38 
AnswerRe: consume external WCF REST services using Angular.js Pin
petra.elhashem7-Mar-14 10:30
petra.elhashem7-Mar-14 10:30 
Questionbody onunload Pin
RabbitTrail6-Mar-14 16:26
RabbitTrail6-Mar-14 16:26 
AnswerRe: body onunload Pin
vbmike7-Mar-14 3:39
vbmike7-Mar-14 3:39 
AnswerRe: body onunload Pin
twseitex13-Mar-14 9:33
twseitex13-Mar-14 9:33 
QuestionHow to Check whether radio button is checked or not [SOLVED] Pin
monsterchub6-Mar-14 5:07
monsterchub6-Mar-14 5:07 
AnswerRe: How to Check whether radio button is checked or not Pin
Peter Leow6-Mar-14 6:25
professionalPeter Leow6-Mar-14 6:25 
First, add a javascript code in the header to validate that all radios are checked, if all checked, proceed to submit else cancel the submit. Next you have to add a submit button in the form, last, modify the form tag to add an onsubmit event to call the validation javascript code. See example:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script type="text/javascript">
function validateRadio()
{
   // get all the inputs type
    var inputs = myform.elements;
    var radios = [];

    // find the radio type
    for (var i = 0; i < inputs.length; ++i) {
        if (inputs[i].type == 'radio') {
            radios.push(inputs[i]);
        }
    }
    var countChecked = 0;
    for (var j = 0; j < radios.length; j++) {
        if (radios[j].checked) {
            countChecked++;
        }
    }

    if (countChecked != radios.length / 2){
       alert("All questions must be answered.");
       return false;  // abort submit
    } else {
       return true; // proceed to submit
    } 
}
</script>
</head>
</head>
 
<body>
<form name="myform" method="post"
	onSubmit="return validateRadio()" action="anotherfile.php">

<!-- your other code --->


</table>
<input type="submit" name="submit" id="submit" value="Submit">
</form>
 
</body>
</html>

GeneralRe: How to Check whether radio button is checked or not Pin
monsterchub6-Mar-14 7:39
monsterchub6-Mar-14 7:39 
GeneralRe: How to Check whether radio button is checked or not Pin
monsterchub6-Mar-14 9:02
monsterchub6-Mar-14 9:02 
AnswerRe: How to Check whether radio button is checked or not Pin
Peter Leow6-Mar-14 16:06
professionalPeter Leow6-Mar-14 16:06 
Questionreference type vs. primitive type Pin
ThetaClear4-Mar-14 20:37
ThetaClear4-Mar-14 20:37 
AnswerRe: reference type vs. primitive type Pin
Richard Deeming4-Mar-14 23:30
mveRichard Deeming4-Mar-14 23:30 
GeneralRe: reference type vs. primitive type Pin
ThetaClear5-Mar-14 1:15
ThetaClear5-Mar-14 1:15 
GeneralRe: reference type vs. primitive type Pin
Richard Deeming5-Mar-14 1:26
mveRichard Deeming5-Mar-14 1:26 
GeneralRe: reference type vs. primitive type Pin
ThetaClear5-Mar-14 1:35
ThetaClear5-Mar-14 1:35 
AnswerRe: reference type vs. primitive type Pin
twseitex13-Mar-14 9:43
twseitex13-Mar-14 9:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.