Jump to content

Hi Folks, I wanted to put Validation for Start date and End ...


vi .

Recommended Posts

Hi Folks,

I wanted to put Validation for Start date and End date filter in Page designer. validation condition: start date will be always less than the Enddate.

I have written JavaScript code in page designer but unfortunately it is not working for me. Here my code.

$(".SUBMIT_BTN_OPERATIONS").on("click",function()

 

{

var startdate=document.getElementsByClassName(DATECONTROL_OPERATIONS)[0].innerText;

var startdatedata=startdate.split(n);

var date1=startdatedata[2];

var mydate = new Date(date1);

var enddate=document.getElementsByClassName("DATECONTROL_OPERATIONS")[1].innerText;

var enddatedata=enddate.split('n');

var date2=enddatedata[2];

var mydate2 = new Date(date2);

if (mydate2.getTime()< mydate.getTime())

{

alert("End date should be greater than Start date");

return false;

}

 

});

thanks in advance!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...