•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 456,479 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,740 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 1644 | Replies: 3
![]() |
•
•
Join Date: Aug 2007
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
Hi,
I have written below code but i do not know how to validate using javascript, cud anyone please help me out.
<select size="1" name="hours" class="selectstyle" style="width:40px" onchange="alert(document.modifyschedule.hours.options[document.modifyschedule.hours.selectedIndex].value">
<?
for($j=1;$j<=24;$j++)
{
if($timesplit[0]==$j)
echo "<option value=".$j." selected>".$j."</option>";
else
echo "<option value=".$j." >".$j."</option>";
}
?>
</select>
<select size="1" name="minutes" class="selectstyle" style="width:40px" onchange="alert(document.modifyschedule.minutes.options[document.modifyschedule.minutes.selectedIndex].value">
<?
if($timesplit[1]=="00")
echo "<option value=\"00\" selected>00</option>";
else
echo "<option value=\"00\">00</option>";
if($timesplit[1]=="15")
echo "<option value=\"15\" selected>15</option>";
else
echo "<option value=\"15\" >15</option>";
if($timesplit[1]=="30")
echo "<option value=\"30\" selected>30</option>";
else
echo "<option value=\"30\">30</option>";
if($timesplit[1]=="45")
echo "<option value=\"45\" selected>45</option>";
else
echo "<option value=\"45\">45</option>";
?>
</select></td></tr>
I have written below code but i do not know how to validate using javascript, cud anyone please help me out.
<select size="1" name="hours" class="selectstyle" style="width:40px" onchange="alert(document.modifyschedule.hours.options[document.modifyschedule.hours.selectedIndex].value">
<?
for($j=1;$j<=24;$j++)
{
if($timesplit[0]==$j)
echo "<option value=".$j." selected>".$j."</option>";
else
echo "<option value=".$j." >".$j."</option>";
}
?>
</select>
<select size="1" name="minutes" class="selectstyle" style="width:40px" onchange="alert(document.modifyschedule.minutes.options[document.modifyschedule.minutes.selectedIndex].value">
<?
if($timesplit[1]=="00")
echo "<option value=\"00\" selected>00</option>";
else
echo "<option value=\"00\">00</option>";
if($timesplit[1]=="15")
echo "<option value=\"15\" selected>15</option>";
else
echo "<option value=\"15\" >15</option>";
if($timesplit[1]=="30")
echo "<option value=\"30\" selected>30</option>";
else
echo "<option value=\"30\">30</option>";
if($timesplit[1]=="45")
echo "<option value=\"45\" selected>45</option>";
else
echo "<option value=\"45\">45</option>";
?>
</select></td></tr>
•
•
Join Date: Jul 2007
Location: Sofia, Bulgaria
Posts: 138
Reputation:
Rep Power: 2
Solved Threads: 10
•
•
Join Date: Aug 2007
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
HI this one may help you it has the valdation of every thing as the time being i sending the whole code.paste it in the dreamweaver or your ide and it will work fine
<em></em><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Make The Move Migration :: Assessment</title>
<link rel="stylesheet" href="../Copy of new/docstyle.css" type="text/css" />
<style type="text/css">
<!--
body {
background-color: #999999;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
<script type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
function dvalid(sDate) {
var re = /^\d{1,2}\/\d{1,2}\/\d{4}$/
if (re.test(sDate))
{
var dArr = sDate.split("/");
var d = new Date(sDate);
return d.getMonth() + 1 == dArr[0] && d.getDate() == dArr[1] && d.getFullYear() == dArr[2];
}
else
{
alert("enter valid date");
return false;
}
return true
}
function echeck(email)
{
//alert(email);
var at=email.indexOf('@');
var dot=email.lastIndexOf('.');
var atpos=email.lastIndexOf('@');
var emlen=email.length;
if (at<1||dot-at<2||atpos+1==emlen||dot+1==emlen||emlen-dot<3)
{
alert('invalid email address');
return false
}
else
{
return true
}
return true;
}
function fvalid()
{
var sel=document.getElementById("mar");
var res=sel.options[sel.selectedIndex].text
var gender=document.getElementById("gender");
var ans=sel.options[gender.selectedIndex].text
if(document.f1.fname.value=="")
{
alert('enter the First name');
document.f1.fname.focus();
return false;
}
if(document.f1.famname.value=="")
{
alert('enter the Famly name');
document.f1.famname.focus();
return false;
}
if(ans=="Select")
{
alert("select your Gender");
document.getElementById("gender").focus();
return false;
}
if(document.f1.country.value=="")
{
alert('enter the Country name');
document.f1.country.focus();
return false;
}
if(document.f1.nation.value=="")
{
alert('enter your Nationality');
document.f1.nation.focus();
return false;
}
if(document.f1.dob.value=="")
{
alert('enter Date of Birth');
document.f1.dob.focus();
return false;
}
if(!dvalid(document.f1.dob.value))
{
document.f1.dob.value="";
document.f1.dob.focus();
return false;
}
if(document.f1.email.value=="")
{
alert('enter email');
document.f1.email.focus();
return false;
}
if(!echeck(document.f1.email.value))
{
document.f1.email.focus();
document.f1.email.value="";
return false;
}
if(res=="Select")
{
alert("select your Martial Status");
document.getElementById("mar").focus();
return false;
}
return true;
}
/*function svalid()
{
var sel=document.getElementById("mar");
var res=sel.options[sel.selectedIndex].text
alert(res);
if(res=="Select")
{
alert("check the box");
return false;
}
return true;
}*/
</script>
</head>
<body onload="MM_preloadImages('../Copy of new/images/nav_home_hover.jpg','../Copy of new/images/nav_visainfor_hover.jpg','../Copy of new/images/nav_about_hover.jpg','../Copy of new/images/nav_assessment_hover.jpg','../Copy of new/images/nav_visaservices_hover.jpg','../Copy of new/images/nav_contact_hover.jpg'),document.f1.fname.focus()" >
<table width="1004" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="254"><img src="../Copy of new/images/banner_01.jpg" width="254" height="117" /></td>
<td width="195"><img src="../Copy of new/images/banner_02.jpg" width="195" height="117" /></td>
<td width="245"><img src="../Copy of new/images/banner_03.jpg" width="245" height="117" /></td>
<td width="10"><img src="../Copy of new/images/banner_04.jpg" width="154" height="117" /></td>
<td width="300"><img src="../Copy of new/images/banner_05.jpg" width="156" height="117" /></td>
</tr>
<tr>
<td><a href="../Copy of new/index.html"><img src="../Copy of new/images/nav_home.jpg" width="254" height="32" border="0" id="Image1" onmouseover="MM_swapImage('Image1','','../Copy of new/images/nav_home_hover.jpg',1)" onmouseout="MM_swapImgRestore()" /></a></td>
<td><img src="../Copy of new/images/banner_07.jpg" width="195" height="32" /></td>
<td><img src="../Copy of new/images/banner_08.jpg" width="245" height="32" /></td>
<td><img src="../Copy of new/images/banner_09.jpg" width="154" height="32" /></td>
<td><img src="../Copy of new/images/banner_10.jpg" width="156" height="32" /></td>
</tr>
</table>
<table width="1004" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td width="254" valign="top"><table width="254" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><a href="../Copy of new/information.html"><img src="../Copy of new/images/nav_visainfor.jpg" width="254" height="29" border="0" id="Image2" onmouseover="MM_swapImage('Image2','','../Copy of new/images/nav_visainfor_hover.jpg',1)" onmouseout="MM_swapImgRestore()" /></a></td>
</tr>
<tr>
<td><a href="../Copy of new/about.html"><img src="../Copy of new/images/nav_about.jpg" width="254" height="29" border="0" id="Image3" onmouseover="MM_swapImage('Image3','','../Copy of new/images/nav_about_hover.jpg',1)" onmouseout="MM_swapImgRestore()" /></a></td>
</tr>
<tr>
<td><a href="../Copy of new/assessment.html"><img src="../Copy of new/images/nav_assessment.jpg" width="254" height="29" border="0" id="Image4" onmouseover="MM_swapImage('Image4','','../Copy of new/images/nav_assessment_hover.jpg',1)" onmouseout="MM_swapImgRestore()" /></a></td>
</tr>
<tr>
<td><a href="../Copy of new/services.html"><img src="../Copy of new/images/nav_visaservices.jpg" width="254" height="29" border="0" id="Image5" onmouseover="MM_swapImage('Image5','','../Copy of new/images/nav_visaservices_hover.jpg',1)" onmouseout="MM_swapImgRestore()" /></a></td>
</tr>
<tr>
<td><a href="../Copy of new/contact.html"><img src="../Copy of new/images/nav_contact.jpg" width="254" height="29" border="0" id="Image6" onmouseover="MM_swapImage('Image6','','../Copy of new/images/nav_contact_hover.jpg',1)" onmouseout="MM_swapImgRestore()" /></a></td>
</tr>
</table></td>
<td width="44" bgcolor="#FFFFFF"> </td>
<td width="730" height="415" valign="top" bgcolor="#FFFFFF"><br />
<table width="95%" border="0" align="center" cellpadding="5" cellspacing="1">
<tr>
<td class="welcome">Assessment </td>
</tr>
<tr>
<td>In order to help us determine your eligibility for migration to Australia please provide us with the following information:</td>
</tr>
<tr>
<td>
<table width="80%" border="0" cellspacing="1" cellpadding="5">
<form name="f1" onSubmit="return fvalid()" >
<tr>
<td width="51%" align="right" bgcolor="#F2F2F2">First Name</td>
<td width="49%" bgcolor="#F2F2F2">
<label>
<input name="fname" type="text" size="30" />
</label> </td>
</tr>
<tr>
<td align="right" bgcolor="#F2F2F2">Family Name</td>
<td bgcolor="#F2F2F2"><label>
<input name="famname" type="text" size="30" />
</label></td>
</tr>
<tr>
<td align="right" bgcolor="#F2F2F2">Gender</td>
<td bgcolor="#F2F2F2"><label>
<select id="gender">
<option>Select</option>
<option>Male</option>
<option>Female</option>
</select>
</label></td>
</tr>
<tr>
<td align="right" bgcolor="#F2F2F2">Country of Residence</td>
<td bgcolor="#F2F2F2"><label>
<input name="country" type="text" size="30" />
</label></td>
</tr>
<tr>
<td align="right" bgcolor="#F2F2F2">Nationality</td>
<td bgcolor="#F2F2F2"><label>
<input name="nation" type="text" size="30" />
</label></td>
</tr>
<tr>
<td align="right" valign="top" bgcolor="#F2F2F2">Date of birth</td>
<td bgcolor="#F2F2F2"><input name="dob" type="text" size="30" />
<strong class="copyright">(mm/dd/yyyy)</strong></td>
</tr>
<tr>
<td align="right" bgcolor="#F2F2F2">E-mail</td>
<td bgcolor="#F2F2F2"><label>
<input name="email" type="text" size="30" />
</label></td>
</tr>
<tr>
<td align="right" bgcolor="#F2F2F2">Marital Status</td>
<td bgcolor="#F2F2F2"><select id="mar">
<option>Select</option>
<option>Married</option>
<option>Single</option>
<option>Divorced</option>
<option>Widowed</option>
<option>Defacto</option>
</select></td>
</tr>
<tr>
<td align="right" bgcolor="#F2F2F2">Other Family members to be included in any application</td>
<td bgcolor="#F2F2F2"><label>
<input name="textfield7" type="text" size="30" />
</label></td>
</tr>
<tr>
<td align="right" bgcolor="#F2F2F2">Occupation</td>
<td bgcolor="#F2F2F2"><label>
<input name="textfield8" type="text" size="30" />
</label></td>
</tr>
<tr>
<td align="right" bgcolor="#F2F2F2">Details of relatives who are Australian citizens or permanent residents</td>
<td bgcolor="#F2F2F2"><label>
<textarea name="textarea" cols="23" rows="3"></textarea>
</label></td>
</tr>
<tr>
<td align="right" bgcolor="#F2F2F2"> </td>
<td bgcolor="#F2F2F2"><label>
<input name="Submit" type="submit" class="buttons" value="Submit" />
<input name="Submit2" type="reset" class="buttons" value="Reset" />
</label></td>
</tr>
</form>
</table></td>
</tr>
<tr>
<td><strong>Upon receipt of this information we will contact you to discuss your the prospects of your application.</strong></td>
</tr>
<tr>
<td> </td>
</tr>
</table></td>
</tr>
</table>
<table width="1004" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="25" align="center" bgcolor="#FFFFFF" class="footerlink"><font size="2 px" color="#0A83CD"><a href="../Copy of new/index.html" class="footerlink">Home </a> | <a href="../Copy of new/information.html" class="footerlink">Visa Information</a> | <a href="../Copy of new/about.html" class="footerlink">About us </a> | <a href="../Copy of new/assessment.html" class="footerlink">Assessment</a> | <a href="../Copy of new/services.html" class="footerlink">Visa Services</a> | <a href="../Copy of new/contact.html" class="footerlink">Contact Us</a></font></td>
</tr>
<tr>
<td height="25" align="center" bgcolor="#FFFFFF" class="copyright">Copyright © makethemove.net.au All Rights Reserved</td>
</tr>
</table>
</body>
</html>
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- onClick html select box help, passing selected value and populating select box (JavaScript / DHTML / AJAX)
- For sheurwayne, Re:" my computer is always crashing" (Viruses, Spyware and other Nasties)
- Select Box populates text field (JavaScript / DHTML / AJAX)
- bringing data from mysql using select box (PHP)
- populate a select box using PHP (PHP)
- passing values of Select box from JSP to Action class thru form Bean (JSP)
- "Cannot find server or DNS Error" and Trojan Virus (Viruses, Spyware and other Nasties)
Other Threads in the PHP Forum
- Previous Thread: Content Mangement System
- Next Thread: How to insert image in directory using mySQL


Linear Mode