How to add validation rule to date and time field

Hi, I need to make a validation of one form field, user enters start date-and-time and end date-and-time and then needs to enter an integer number, I have to validate on the form that the entered number is smaller or equal to the difference of end date-and-time minus start date-and-time?

I created a JS that throws an alert if the entered number is larger, but I still can not validate the field and prevent the user from submitting the form.

Can I somehow use the output from "Event rule" for validation?

Help please?

OriginalPostID-22392

OriginalPostID-22392

  Discussion posts and replies are publicly visible

Parents
  • Hi, I know, I have added validation rules before, but in this case I need to call a whole Java script that needs to read values from the same form and compare them, and return "true" or "false".

    I have a script in JS library that calls for "window.FormAPI.getValue("field")" but I think this is not retreiving the data from the fields. Can I use these form APIs in Java scripts in the library and what is the correct way to read values from the form?
Reply
  • Hi, I know, I have added validation rules before, but in this case I need to call a whole Java script that needs to read values from the same form and compare them, and return "true" or "false".

    I have a script in JS library that calls for "window.FormAPI.getValue("field")" but I think this is not retreiving the data from the fields. Can I use these form APIs in Java scripts in the library and what is the correct way to read values from the form?
Children
No Data