Please use this function, i hope this may help you.

File 1 : date.cfm
===============

<cfset Variables.ServerDate = Month(Now()) & "/" & Day(Now()) & "/" &
Year(Now())>
<script language="JavaScript">
<!--
var tmpDate = "<cfoutput>#Variables.ServerDate#</cfoutput>";
var serverDate = new Date(tmpDate);
function DoVerify()
{
 with (document.testForm)
 {
  var selDate = month.options[month.selectedIndex].value + "/" +
day.options[day.selectedIndex].value + "/" +
year.options[year.selectedIndex].value;
  var selectedDate = new Date(selDate);
  if (selectedDate <= serverDate)
  {
   alert("selected date is earlier than current system date");
   return false;
  }
 }
 return true;
}
// -->
</script>

<body>
<form name="testForm" action="actionpage.cfm" method="post"
onsubmit="javascript:return DoVerify();">
select the Form Date : <br><select name="month"><cfloop index="i" from="1"
to="12"><cfoutput><option value="#i#" <cfif i EQ
Month(Now())>selected</cfif>>#MonthAsString(i)#</option></cfoutput></cfloop>
</select>
<select name="day"><cfloop index="i" from="1" to="31"><cfoutput><option
value="#i#" <cfif i EQ
Day(Now())>selected</cfif>>#i#</option></cfoutput></cfloop></select>
<select name="year"><cfloop index="i" from="#Evaluate(Year(Now()) - 10)#"
to="#Evaluate(Year(Now()) + 10)#"><cfoutput><option value="#i#" <cfif i EQ
Year(Now())>selected</cfif>>#i#</option></cfoutput></cfloop></select><br>
<input type="Submit" value="Validate the date">
</form>
</body>


File 2 : actionpage.cfm
=====================

<cfoutput>
 Selected Month : #MonthAsString(Form.month)#<br>
 Selected Day : #Form.Day#<br>
 Selected Year : #Form.Year#
</cfoutput>



please copy the above sources under your web directory and save them with
the appropriate names given.


HTH

Subramanian Chakrapani


----- Original Message -----
From: The Hepburn's <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, January 20, 2001 3:13 AM
Subject: OT:Java Script Form Validation


> Have a form that I need to validate.  Users will enter when they want a
> project completed by.  I need to make sure they do not enter Today's' Date
> or earlier.  Have searched the web but have been unable to find a script
> that does this.  Obviously, I do not know Java Script.  Was hoping someone
> out there has a script I could use that would accomplish this.  Currently
> using CFIF's on the action page but would prefer this get validated before
> they get to the next page.  can anyone help??
>
>
> -------------------------------------------------------------------------
> This email server is running an evaluation copy of the MailShield anti-
> spam software. Please contact your email administrator if you have any
> questions about this message. MailShield product info: www.mailshield.com
>
> -----------------------------------------------
> To post, send email to [EMAIL PROTECTED]
> To subscribe / unsubscribe: http://www.dfwcfug.org
>


-------------------------------------------------------------------------
This email server is running an evaluation copy of the MailShield anti-
spam software. Please contact your email administrator if you have any
questions about this message. MailShield product info: www.mailshield.com

-----------------------------------------------
To post, send email to [EMAIL PROTECTED]
To subscribe / unsubscribe: http://www.dfwcfug.org

Reply via email to