Time fields validation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2024 10:46 AM
Hello friends
Happy Knowledge week! How all is well.
I have an ask that I'm having a slight issue trying to make happen.
I have a Record Producer with variables that I need to make sure each variable is after the next.
These fields are string fields with the validation regex as Time (00:00) 24 hr.
I need there to be a validation and error that the field entered is after the previous field.
Meal Out should be after Time In
Meal In should be after Time In & Meal Out
Time Out should be after Time In, Meal Out, & Meal In
I originally created these fields as Date/Time but the business only wanted times
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2024 11:18 AM
Being that they are string fields, is sounds like you'll need to take the date selected and value entered and call a script include via ajax to do the date/time validation. If it doesn't validate, you'll have to throw an error on the field and clear the value. It's a little messy but seems doable.
If you can convince the customer to go w/ a date/time field, all you need are UI Policies. Winner!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2024 05:52 AM
I did try to convince them. 😂
I need to show that 17:30 is after 17:29, etc. There is no date needed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2024 06:05 AM - edited 05-07-2024 06:05 AM
So since no date is needed, then everything is expected to happen 'today'?
Meaning, I can't submit a request for a day in the past.
I only ask cause when doing the comparisons, the Date/Time API might need a date...maybe
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2024 07:22 AM
When I did have them as Date/Time fields, I had a validation script which took care of this.
They are using these as a time card punch correction form.
I was thinking/hoping there was a something similar to this for a numeric string in time format.
if (startTime.getTime() >= endTime.getTime()) {