Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
3 replies
Subscribers
8 subscribers
Views
5101 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
I am looking for a way to validate that a user entered date (in a text field) is
ryanh
over 11 years ago
I am looking for a way to validate that a user entered date (in a text field) is a valid date, or at least reasonably matches the format mm/dd/yyyy. I was unable to find any native Appian expressions/functions that will validate a date format (and the Masking functions aren't allowed on Tempo/Mobile enabled forms).
I was able to find references to the component 'Appian Regular Expression Functions' that has the regexmatch() function. With a little digging online I built an expression that tests a date and returns true for 01/01/1970-12/31/2039 and a false outside that range or formatting. However, it doesn't know the difference for leap years, etc.
=regexmatch("^(?:[1-9]|0[1-9]|1[0-2])/(?:[0-9]|0[1-9]|1[0-9]|2[0-9]|3[0-1])/(?:19[7-9][0-9]|20[0-3][0-9])$",ri!date)
Is there a built in function in Appian to allow server or client side validation of dates to minimize typos? I am not at this time using the SAIL and Tempo functionality?...
OriginalPostID-103408
OriginalPostID-103408
Discussion posts and replies are publicly visible
Parents
0
ryanh
over 11 years ago
We are using a grid in a Portal form to allow multiple rows of data to be updated. The grid interface only allows text & numeric type fields, no dates. I've considered changing the grid to a paging grid but that would require significantly more testing (though it allows a date picker I believe).
I now have a sample model that tests a text string and trims the date entered using an expression and the regex code above. It appears to work and I'm going to try it implementing it in my code today. It doesn't check for leap years, etc. but works with a blank field I believe as well as one with spaces in it (you also pass in true/false to indicate if spaces are allowed. Happy to share my code. Wish there was a standard function/expression for testing that a typed string was a valid date.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Reply
0
ryanh
over 11 years ago
We are using a grid in a Portal form to allow multiple rows of data to be updated. The grid interface only allows text & numeric type fields, no dates. I've considered changing the grid to a paging grid but that would require significantly more testing (though it allows a date picker I believe).
I now have a sample model that tests a text string and trims the date entered using an expression and the regex code above. It appears to work and I'm going to try it implementing it in my code today. It doesn't check for leap years, etc. but works with a blank field I believe as well as one with spaces in it (you also pass in true/false to indicate if spaces are allowed. Happy to share my code. Wish there was a standard function/expression for testing that a typed string was a valid date.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Children
No Data