- For individual users
- Instant access to solutions
- Ask your tech questions
- Start your 30-day Free Trial
Main Topics
Browse All TopicsHi,
I'm working on a form that has already been created for 2004 & updating it for 2005. The previous web developer used the following code to validate the credit card expiration date form field. I'm not sure what she was doing here, or if it will still be accurate for 2005. Can anyone both explain to me what she was doing, tell me how to change it to be accurate for 2005, and possibly even offer a better way of validating the expiration date of a credit card?
This is the validation code:
<cfif Evaluate(DateCompare(Creat
<cfset errorcount = errorcount + 1>
</cfif>
This is the form field:
<tr valign="top">
<td align="right"><B<cfif Evaluate(DateCompare(Creat
<td><select name="cardExpMonth" class="formField">
<cfloop index="i" from="1" to="12">
<option <cfif DateFormat(CreateDate(2005
</cfloop>
</select>
<select name="cardExpYear" class="formField">
<cfloop index="i" from="05" to="14">
<option <cfif DateFormat(CreateDate(i, 01, 01), "yy") EQ form.cardexpyear>selected </cfif>value="#DateFormat(
</cfloop>
</select>
</td>
</tr>
Thanks,
Katrina
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: mrichmonPosted on 2005-05-27 at 09:07:43ID: 14096064
Not sure ehat was being done. But really what you want is this which doesn't need to be updated per year:
m.Exp_Year , Form.Exp_Month, (DaysInMonth(CreateDate(Fo rm.Exp_Yea r, Form.Exp_Month, 1)))), Now()) IS -1>
<cfif Form.Exp_Month EQ "" OR Form.Exp_Year EQ "">
<!--- Make sure that a month and year were entered --->
<cfset ErrorMsg = ErrorMsg & "Expiration ">
<cfelseif DateCompare(CreateDate(For
<!--- Compare Now with last day of month that card expires to find out if Card has expired --->
<cfset ErrorMsg = ErrorMsg & "Expired ">
</cfif>