Isaac
asked on
coldfusion and Javascript
I have a form with a field that pulls a date from the database and also a field that accepts a date.
I want to make sure that the date entered in the form is not less than what's being pulled from the database.
This is what I have so far but it's not working:
<CFSET todaysDate = #DateFormat(Now(), "DD MMM YYYY")#>
<SCRIPT type="text/javascript">
<!--
function fraud_onSubmit(theForm)
{
var controlCounter;
var returnValue = true;
var formControl;
if (theForm.closed_date.value < <cfoutput>#todaysDate#</cf output>)
{
alert("hello");
return false;
}
return returnValue;
}
// -->
</script>
Thank you for your help in advance.
I want to make sure that the date entered in the form is not less than what's being pulled from the database.
This is what I have so far but it's not working:
<CFSET todaysDate = #DateFormat(Now(), "DD MMM YYYY")#>
<SCRIPT type="text/javascript">
<!--
function fraud_onSubmit(theForm)
{
var controlCounter;
var returnValue = true;
var formControl;
if (theForm.closed_date.value
{
alert("hello");
return false;
}
return returnValue;
}
// -->
</script>
Thank you for your help in advance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
also, instead of doing DD MMM YYYY just do a single D with dashes. "D-MMM-YYYY"
What error message are you getting if any?
What error message are you getting if any?
Try this script
<CFSET todaysDate = #DateFormat(Now(), "DD MMM YYYY")#>
<SCRIPT type="text/javascript">
<!--
function fraud_onSubmit(theForm)
{
var controlCounter;
var returnValue = true;
var formControl;
var datenow = new Date(<cfoutput>#todaysDate #</cfoutpu t>);
var dateform = new Date(theForm.closed_date.v alue);
if (dateform < datenow)
{
alert("hello");
return false;
}
return returnValue;
}
// -->
</script>
Suresh :)
<CFSET todaysDate = #DateFormat(Now(), "DD MMM YYYY")#>
<SCRIPT type="text/javascript">
<!--
function fraud_onSubmit(theForm)
{
var controlCounter;
var returnValue = true;
var formControl;
var datenow = new Date(<cfoutput>#todaysDate
var dateform = new Date(theForm.closed_date.v
if (dateform < datenow)
{
alert("hello");
return false;
}
return returnValue;
}
// -->
</script>
Suresh :)
I am not sure about the answer but just wanted to make sure if following is producing correct output.
#DateFormat(Now(), "DD MMM YYYY")#>
Try this #DateFormat(Now(), "DD MM YYYY")#>
This not the answer but just found something in your code so I just dropped a note.
Regards,
---Pinal