Crow Canyon Software Forum

Forum Navigation
Please or Register to create posts and topics.

Problem with this script?

I have what appears to be a very simple script but it doesn't seem to work (no validation message).
If I compare the current value with GetDate() I can successfully check for no past dates - but when I try to compare the current value with the value from another form field nothing happens. I have double checked I am using the internal field name and the case is correct.
The validation is on the field returnFlight and I need to make sure that returnFlight is > departFlight

var returnFlight = new Date(objData.ColumnValue);
var departFlight = new Date();

departFlight.setDate(objData.FormContext.fetchColumnValueUI("FlightDepart"));

if(returnFlight < departFlight) {
objData.Status = false;
objData.Message = "Return flight cannot be prior to the departure flight"

return objData;

We can directly use column placeholder to compare date columns in column validations of NITRO forms. Please refer sample configuration from below.

Column Placeholder Syntax: [ColumnInternalName]

Uploaded files:
  • DateValidation.png

That is perfect, never knew you could do that. Thanks!