Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Credit Card date greater than today

Featured Replies

I have three credit card expirtion fields all number called ExpMo, ExpDay and ExpYear. Year is 4 digits. I am trying to validate credit card expiration dates but have something wrong.

The following appears to work but when i look closer, it says a card with 1 in ExpMo and 2004 in ExpYear displays as valid. shocked.gif Could you help me figure what I have wrong?

Calculation is text unstored as:

If(not IsEmpty(ExpMo) or not IsEmpty(ExpDay) or not IsEmpty(ExpYear) and

Date(Month(ExpMo); Day(ExpDay); Year(ExpYear)) great.gif ; Get(CurrentDate); "Valid Card"; "Invalid Card")

The other thing I'm trying to do is add auto-enter to the year field so it must be 2004. I don't want to validate - just change what they enter so its four digits. I have validation set to must be number and I added this to auto-enter calculation with do not replace unchecked. If I enter 2004 in ExpYear, it works ... but if I enter anything else like 4 for the year, it gives me a 1. Can you help me with this calc also?

GetAsText ( Case(Length(ExpYear) = 2; "20" and ExpYear;

Length(ExpYear) = 1; "200" and ExpYear; ExpYear))

tongue.gif

thanks, Pete

OOOPS! It didn't paste right when I had to correct for the greater than thing. please remove the ';'after the greater than sign on the first calc. blush.gif

The Date calculation will give you an invalid result if you have no ExpDay data. You can see this by creating another field of Date(Month(ExpMo); Day(ExpDay); Year(ExpYear)) and entering 1 for the month and 2004 for the year.

I think you want to use AND instead of OR. The OR will produce a true result when any of the fields are not empty, while the AND will produce a true result only when all of the fields are not empty.

Change 'and' (a boolean operator) in the second calc to & (a text operator).

  • Author

Me bad ... and versus & ... of course, silly mistake, thank you. it works perfect now. smile.gif

I neglected to mention (sorry JT) that some cards have an ExpDay and some don't. I adjusted the calc to using and instead of or ... but I need to account that - if the ExpDay is blank but ExpMo and ExpYear aren't, it inserts the last day of that month in the day spot. I hope this makes sense. Well, I started it but got stuck ...

Case(not IsEmpty(ExpMo) and not IsEmpty(ExpYear) and

Date(Month(ExpMo); If(not IsEmpty(ExpDay); ExpDay; last day of month??); Year(ExpYear)) great.gif Get(CurrentDate); "Valid Card"; "Invalid Card")

I don't know what to put in place of the bold. crazy.gif or would you list it different than this? Thank you for helping me. grin.gif

I just noticed you had redundant Month, Day, and Year functions for the numbers that already define those. Changing that, adding the last day of month result, and an extra tweak I added just because I'm a dork gives

Case(not IsEmpty(ExpMo) and not IsEmpty(ExpYear) and

Date( ExpMo; Case(not IsEmpty(ExpDay); ExpDay; Day(Date( ExpMo + 1; 0; ExpYear ))); ExpYear ) >= Get(CurrentDate); "V"; "Inv" ) & "alid Card"

  • Author

Oh! Too clever I really like that twist on V-Alid!! And it works perfectly also! Uh, originally when I converted the incorrect fields to number, it was for this very reason - so I could just use the numbers. But i had forgotten. blush.gif That was months ago and I got side-tracked.

Staff is going to love this, thanks so much Queue. Dancing-Chilli.gif

P

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.