Need to validate the Date input field

I have 2 date field

{ type:“calendar”, name:“start_date”, label:“AGMT. START DATE”,position:“absolute”, dateFormat: “%d-%m-%Y”, serverDateFormat:“%Y-%m-%d”,calendarPosition: “right” ,validate:“NotEmpty” },
{ type:“calendar” , name:“end_date”, label:“AGMT. END DATE”, position:“absolute”, dateFormat: “%d-%m-%Y”, serverDateFormat:“%Y-%m-%d”, calendarPosition: “right” ,validate:“NotEmpty” },

Onclick or onchange

End date should be before the start end.
it should give alert or it should disable select option

Please help me with codes

Hello
Could you clarify your question?

Hi,

for example i select a date on the form field start_date: 02-03-2014

then i select next data in the form field end_date: 01-03-2014.

I need to validate the end_date field.

Case 1 end_date should not have date before the start_date it should pop-up with message “please select the dates after Agreement Start Date”

Case 2 if the end_date has a date after the start_date then it can allow.

Hi

  1. you can disable dates in calendar for end_date

myForm.attachEvent("onChange", function(name){ if (name == "start_date") { // check end_date here // you can reset (clear) form value for end_date // also myForm.getCalendar("end_date").setInsensitiveRange(null, to); // to - selected value in start_date } })

demos: dhtmlx.com/docs/products/dht … e_and_dis/
docs: docs.dhtmlx.com/doku.php?id=dhtm … itiverange

  1. validation:

{ type:"calendar" , name:"end_date", ... ,validate: function(value){ if (value < start_date_value_here or start_value_not_set or something_else) return false; return true; } }