cancel
Showing results for 
Search instead for 
Did you mean: 
bimi82
Nintex Newbie

How to validate the Time control on a Date/Time

Jump to solution

Hi,

I am trying to validate the TIME on a date/time function.
I manage to validate the date but the time is always set to 00:00 by default.

If someone does pick the date but not the time > the validation goes through.
However, it is important that the user also picks the relevant time.


Yes, the process is to set the time but some users do not follow the instructions.
How would I be able to validate if the time is set to 00:00 then display error "please select the time..."

Current validation is set to:  BookingDateTime < Current Date && Is New Mode

Labels: (2)
Tags (1)
0 Kudos
Reply
3 Replies
bamaeric
Nintex Newbie

Re: How to validate the Time control on a Date/Time

Jump to solution

Hi Bim.  I think I was able to figure it out.  Try the steps below and let me know if it works for you.

  1. Add a "Calculated Value" control to the form.
  2. Set the formula for the "Calculated Value" control to:  formatDate(DateControlName, "hhmm")
    1. DateControlName is the name of your Date/Time control on the form.
    2. The result of the "Calculated Value" control would be "0000" by default.
  3. Add a form validation rule to your Date/Time control and configure it like:
    1. Rule Type = Validation
    2. Condition = contains(CalcValueControl, "0000") where CalcValueControl is the name of the control created in Step 2.
    3. Message = Enter your message
  4. That should make the Date/Time input control invalid if the date/time is not changed.
  5. Also, you'll probably want to create a rule to hide the "Calculated Value" control.

Nintex Forms 2013 - Date Validation 2

Nintex Forms 2013 - Date Validation 1

Nintex Forms 2013 - Date Validation 3

Reply
bimi82
Nintex Newbie

Re: How to validate the Time control on a Date/Time

Jump to solution

Hi Eric

This is what I already tried and strangely it does not work at all!
The calculated field does not show any figures when running a test ....

However, the calculated value shows the value only when the form has been submitted.
Therefore, I think there is a JavaScript which forces the field to automatically update but unsure how that is done

The BookingDateTime format is set to: Standard.

0 Kudos
Reply
bimi82
Nintex Newbie

Re: How to validate the Time control on a Date/Time

Jump to solution

UPDATE

I have come across the following article in the forum: Validate Time portion of date/time control in a form

whereby Marian Hatala suggested the following formula as a validation

equals(formatDate(StartDate,'hhtt'),'12AM')

 

In my case, I am using the 24hr date format and had to change the formula as following:

equals(formatDate(BookingDateTime,'HHmm'),'0000')

RESULT

in hope there won't a be a flight at 00:00 lol

Reply