function validateForm() {// Assume that the form is valid.var result = true;// Get handles for the start and end date items.var startItem = IWDatacapture.getItem("/start");var endItem = IWDatacapture.getItem("/end");// Create date objects for the start and end dates.var startDate = Date.parse(startItem.getValue());var endDate = Date.parse(endItem.getValue());// Is the start date after the end date?if (startDate.getTime() > endDate.getTime()) {// Yes. Set the start date as invalid.startItem.setValid(false);// Go into highlight mode.IWDatacapture.setHighlightMode(true);// Redraw the form to show the new label.IWDatacapture.redrawLabels();// Inform the user of the error.alert("Start date cannot be after end date.");// Return false to terminate the save.result = false;}return result;}