Cameron Posted January 15, 2016 Report Share Posted January 15, 2016 Hi everyone, I wanted to search records from the entered date to the entered date + 7 days. Is it possible? Thank you for your time! Quote Link to comment Share on other sites More sharing options...
Jan Posted January 15, 2016 Report Share Posted January 15, 2016 Hi Cameron, You can follow the steps: On the Search screen, select the date field, click "add a field", select "New Criteria". Select the field again, in the "Logical operator between criteria" field, select "AND". Select Criteria 1, in the "Comparison type", select "Greater than or equal". Select Criteria 2, in the "Form element" field, select "Hidden"; in the "Comparison type", select "Greater than or equal". Add the Header&Footer element, select Footer, click the Source button or disable HTML Editor and enter the following code: <SCRIPT LANGUAGE="JavaScript"> function setDate() { number_of_the_field = 1; numberDays = 7; var fieldname1 = "Value"+number_of_the_field+"_1"; var fieldname2 = "Value"+number_of_the_field+"_2"; var stringDate = document.getElementById(fieldname1).value; var myDate = new Date(Date.parse(stringDate)); myDate.setDate(myDate.getDate()+numberDays); var myMonth = myDate.getMonth() + 1; if (myMonth<10) {myMonth = "0" + myMonth;} var myDay = myDate.getDate(); if (myDay<10) {myDay = "0" + myDay;} var myYear = myDate.getFullYear(); var result = myMonth + "/" + myDay + "/" + myYear; document.getElementById(fieldname2).value=result; } document.getElementById("caspioform").onsubmit=setDate; </SCRIPT> number_of_the_field - is the order number of the field on the page. If it's the first page, than enter "1".numberDays - enter the number of days that should be added. I hope, it helps. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.