LoveNintex
Scholar

New Responsive - Input Field Validation for Time Field

Jump to solution

My client wants a "time" field, separate from a date/time field where the user will type in the mm:ss am/pm.  I think the "Input Validation" will help with this.  But I am having trouble figuring out how to configure either the "Text Mask" or the "Regular Expression".  I'd like the validation to enforce a 1 or 2 digit hour, a colon, a 2 digit minute and a required AM or PM.

For example  05:30 AM  or 12:15 PM

Also,  Is there a link that explains "Text Mask" or "Regular Expression"? 

Labels: (1)
0 Kudos
Reply
4 Replies
MeganGo
Nintex Employee
Nintex Employee

Re: New Responsive - Input Field Validation for Time Field

Jump to solution
^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]\s(AM|PM)$
0 Kudos
Reply
LoveNintex
Scholar

Re: New Responsive - Input Field Validation for Time Field

Jump to solution

This works perfect in Regular Expression.  Thank you!

0 Kudos
Reply
LoveNintex
Scholar

Re: New Responsive - Input Field Validation for Time Field

Jump to solution

@MeganGo You helped me with a field validation for time.  Now I need one for a date.  My customer does not want to use the date widget that comes along with a date field because the dates can be 30 or 40 or more years back.  So, I thought I'd provide a text field with a date validation. It needs to be in Year, Month, Day order with a required 4 digit year, 2 digit month and 2 digit day so that the field can be sorted.   Something like YYYY/MM/DD , ui.e. 1950/05/01.  The year can go back as far as 1900.   Can you help me with a field validation that will do this? 

0 Kudos
Reply
LoveNintex
Scholar

Re: New Responsive - Input Field Validation for Time Field

Jump to solution

I found an input validation that will check for YYYYMMDD. It works with and without dashes and for any year. For consistency, it would be nice if it either worked with dashes or no dashes, but not both. I do not know or understand regex enough to modify it:

 ^([0-9]{4}[-/]?((0[13-9]|1[012])[-/]?(0[1-9]|[12][0-9]|30)|(0[13578]|1[02])[-/]?31|02[-/]?(0[1-9]|1[0-9]|2[0-8]))|([0-9]{2}(([2468][048]|[02468][48])|[13579][26])|([13579][26]|[02468][048])00)[-/]?02[-/]?29)$

 

0 Kudos
Reply