Time:
Scotland: Fri, 10:19 pm
Rhode Island: Fri, 5:19 pm
Florida: Fri, 5:19 pm
New Mexico: Fri, 3:19 pm
California: Fri, 2:19 pm

Click here to visit Livelife365.com

Click here to visit nmdarts.com



Buy this Ad Space.

180px wide.

Please get in touch with KH@ if you are interested and make an offer.

CLICK HERE TO GET AUCTION BAR NOW
US$10 per year - Save $100s!
The Fabulously Unfair
WebX Auction Bar. For Ebay etc.
Ro-Sham-Bo the opposition. Laugh like Eric Cartman when you win! CLICK HERE NOW!


More information and sign-up.

WebXpertz Hosting.
Custom fit from $5pm. PHP/MySQL
You'll save money, we'll save money. Seems fair to me. Interested? If so Please PM me here and tell me what you need. Thanks!


Please click here for more information

For continued disscussion on this topic : client side versus server side check


muscle
11-25-2003, 05:35 PM
I have a form in which a user selects two dates from a select box, firstMon and secondMon. Basically I'm running a server side check like so in coldfusion to verify the second date is not before the first date like so....

<cfif form.firstMon GT form.secondMon>
<script>
alert('Please select a proper date.');
document.location.href = 'search.cfm';
</script>
<cfelse>

I'd prefer to do this before the user even proceeds to the process page. Is this possible?

Here is an example, with no form action etc. basically on submit or even after the user selects the second date, I'd like to pop up some kind of alert if the first date is after the second date.

http://www.orlando-fitness.com/date.cfm

jaysolomon
11-25-2003, 07:18 PM
Maybe this will help you

<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
<!--
function val(fObj){
var sel1 = fObj["firstMon"].options[fObj["firstMon"].selectedIndex].text;
var sel2 = fObj["secondMon"].options[fObj["secondMon"].selectedIndex].text;
if(new Date(sel2)< new Date(sel1)){
alert("Date is before the firstMon")
return false;
} else {
return true;
}
}

// -->
</script>
</head>
<body>
<form name="form1" method="post" action="" onsubmit="return val(this);">
<select name="firstMon">
<script language="JavaScript">
<!--
var m = new Date("Jun 04, 2001")
m.setHours(5);

var d = new Date();
var dow= d.getDay();
d = new Date(((dow==0)?-6:1-dow)*86400000+d.valueOf())

var td = (d.getMonth()+1)+"/"+d.getDate()+"/"+d.getFullYear()

for (i=0;i<152;i++)
{ var s = (m.getMonth()+1)+"/"+m.getDate()+"/"+m.getFullYear();
document.writeln("<option "+((td==s)?"selected ":"")+"value='"+s+"'>"+s+"</option>");
m = new Date( m.valueOf()+604800000);
}
//-->
</script>
</select>
<select name="secondMon">
<script language="JavaScript">
<!--
var m = new Date("Jun 04, 2001")
m.setHours(5);

var d = new Date();
var dow= d.getDay();
d = new Date(((dow==0)?-6:1-dow)*86400000+d.valueOf())

var td = (d.getMonth()+1)+"/"+d.getDate()+"/"+d.getFullYear()

for (i=0;i<152;i++)
{ var s = (m.getMonth()+1)+"/"+m.getDate()+"/"+m.getFullYear();
document.writeln("<option "+((td==s)?"selected ":"")+"value='"+s+"'>"+s+"</option>");
m = new Date( m.valueOf()+604800000);
}
//-->
</script>
</select>
<input type="submit" name="Submit" value="Submit">
</form>
</body>
</html>

muscle
11-25-2003, 07:43 PM
Excellent!! Thanks a million!

jaysolomon
11-25-2003, 08:04 PM
Glad to have helped.

Good Luck
jAy

Vincent Puglia
11-25-2003, 08:53 PM
Hi muscle,

Excellent!! Thanks a million!

Gee...a million what?? cups of :coffee: ?? :D


Hi jay & welcome to the City that fixes all problems eventually -- even yours. Glad to see you managed to post :D

Vinny

jaysolomon
11-25-2003, 09:04 PM
Hi Vinny

Thanks for the warm welcome :D

COBOLdinosaur
11-26-2003, 12:05 AM
Hmm.... more familar faces all the time. When does Michel show up? :rolleyes:

Vincent Puglia
11-26-2003, 12:07 AM
Hi Cobol :D

I'm betting on fritz the blank. Gee, you think my posting this url all over the place is bringing people in?

:D

Vinny

COBOLdinosaur
11-26-2003, 12:38 AM
Wherever I go the expert world follows. ;)