
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2019 01:02 PM
I'm working on creating a new Catalog Item for requesting a scheduled report. As part of this I need a way for the requester to enter what time of day they want the report to run, but there is not a variable for Time only. There is Date and Date/Time. I did some digging and it looks like people are using Select Box variables and populating them with options for every 30 minutes throughout the day, but I'm looking for someone that allows them to enter a specific time down to the minute.
Does anyone have some suggestions on how I can get this done?
Solved! Go to Solution.
- 5,128 Views

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2019 01:12 PM
You could single line text field with some examples of the format. Then use a regular expression to validate what they have entered. Example regular expression below for 24 hour clock.
24 Hour clock
/^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/
12 Hour clock
/((1[0-2]|0?[1-9]):([0-5][0-9]) ?([AaPp][Mm]))/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2021 04:53 AM
Hello Brian,
can you please explain little more or how to achive this functanality.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2021 09:09 AM
You would use an on change client scrip with a regular expression. If it does not meeting the regular expression then you toss up an alert and wipe the field?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2021 10:31 AM
Can you provide the script that would do this?
Thanks,
Brandon

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2021 09:33 AM
The code would look like this in an onChange client script. Typically when I have these my variable is mandatory so I just clear the value they put and popup an alert.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
var pattern = /^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/.test(newValue);
if (!pattern) {
g_form.setValue('employee_id', '');
alert("Time must be in 24 hour clock format.");
}
}