Can you help to make one alert with all details?
[CODE=javascript]<script type="text/javascript">
<!--
function validate_form ( )
{
valid = true;
if ( document.form.n ame.value == "" )
{
alert ( "Please fill in the 'Your Name' box." );
valid = false;
}
if ( ( document.form.g ender[0].checked == false ) && ( document.form.g ender[1].checked == false ) )
{
alert ("Please choose gender" );
valid = false;
}
if ( document.form.a ge.selectedInde x == 0 )
{
alert ("Please select your age." );
valid = false;
}
if ( document.form.t erms.checked == false )
{
alert ( "Please check the Terms & Conditions box." );
valid = false;
}
return valid;
}
//-->
</script>
[/CODE]
Full details here
[HTML]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitl ed Document</title>
<script type="text/javascript">
<!--
function validate_form ( )
{
valid = true;
if ( document.form.n ame.value == "" )
{
alert ( "Please fill in the 'Your Name' box." );
valid = false;
}
if ( ( document.form.g ender[0].checked == false ) && ( document.form.g ender[1].checked == false ) )
{
alert ("Please choose gender" );
valid = false;
}
if ( document.form.a ge.selectedInde x == 0 )
{
alert ("Please select your age." );
valid = false;
}
if ( document.form.t erms.checked == false )
{
alert ( "Please check the Terms & Conditions box." );
valid = false;
}
return valid;
}
//-->
</script>
</head>
<body>
<form id="form" name="form" method="post" action="" onSubmit="retur n validate_form ( );">
<table width="500" border="1" align="center">
<tr>
<td>Your Name</td>
<td>:</td>
<td>
<input name="name" type="text" id="name" /> </td>
</tr>
<tr>
<td>Your Gender</td>
<td>:</td>
<td><label>
<input type="radio" name="gender" id="Male" value="Male" />
</label>
Male
<label>
<input type="radio" name="gender" id="Female" value="Female" />
Female</label></td>
</tr>
<tr>
<td>Your Age</td>
<td>:</td>
<td><label>
<select name="age" id="age">
<option>Slect your age</option>
<option value="0-16">0-16</option>
<option value="17-20">17-20</option>
<option value="21-30">21-30</option>
<option value="31-40">31-40</option>
<option value="41-50">41-50</option>
<option value="51-60">51-60</option>
</select>
</label></td>
</tr>
<tr>
<td>Do you agree the terms and coditions</td>
<td>:</td>
<td><label>
<input name="terms" type="checkbox" id="terms" value="Yes" />
Yes
<input name="terms2" type="checkbox" id="terms2" value="no" />
No</label></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><label>
<input type="submit" name="submit" id="submit" value="Submit" />
</label></td>
</tr>
</table>
</form>
</body>
</html>[/HTML]
[CODE=javascript]<script type="text/javascript">
<!--
function validate_form ( )
{
valid = true;
if ( document.form.n ame.value == "" )
{
alert ( "Please fill in the 'Your Name' box." );
valid = false;
}
if ( ( document.form.g ender[0].checked == false ) && ( document.form.g ender[1].checked == false ) )
{
alert ("Please choose gender" );
valid = false;
}
if ( document.form.a ge.selectedInde x == 0 )
{
alert ("Please select your age." );
valid = false;
}
if ( document.form.t erms.checked == false )
{
alert ( "Please check the Terms & Conditions box." );
valid = false;
}
return valid;
}
//-->
</script>
[/CODE]
Full details here
[HTML]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitl ed Document</title>
<script type="text/javascript">
<!--
function validate_form ( )
{
valid = true;
if ( document.form.n ame.value == "" )
{
alert ( "Please fill in the 'Your Name' box." );
valid = false;
}
if ( ( document.form.g ender[0].checked == false ) && ( document.form.g ender[1].checked == false ) )
{
alert ("Please choose gender" );
valid = false;
}
if ( document.form.a ge.selectedInde x == 0 )
{
alert ("Please select your age." );
valid = false;
}
if ( document.form.t erms.checked == false )
{
alert ( "Please check the Terms & Conditions box." );
valid = false;
}
return valid;
}
//-->
</script>
</head>
<body>
<form id="form" name="form" method="post" action="" onSubmit="retur n validate_form ( );">
<table width="500" border="1" align="center">
<tr>
<td>Your Name</td>
<td>:</td>
<td>
<input name="name" type="text" id="name" /> </td>
</tr>
<tr>
<td>Your Gender</td>
<td>:</td>
<td><label>
<input type="radio" name="gender" id="Male" value="Male" />
</label>
Male
<label>
<input type="radio" name="gender" id="Female" value="Female" />
Female</label></td>
</tr>
<tr>
<td>Your Age</td>
<td>:</td>
<td><label>
<select name="age" id="age">
<option>Slect your age</option>
<option value="0-16">0-16</option>
<option value="17-20">17-20</option>
<option value="21-30">21-30</option>
<option value="31-40">31-40</option>
<option value="41-50">41-50</option>
<option value="51-60">51-60</option>
</select>
</label></td>
</tr>
<tr>
<td>Do you agree the terms and coditions</td>
<td>:</td>
<td><label>
<input name="terms" type="checkbox" id="terms" value="Yes" />
Yes
<input name="terms2" type="checkbox" id="terms2" value="no" />
No</label></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><label>
<input type="submit" name="submit" id="submit" value="Submit" />
</label></td>
</tr>
</table>
</form>
</body>
</html>[/HTML]
Comment