i am trying to find a way to calculate dates. for our event security requests forms need to be filled out 10 days prior to event. if they do not meet these requirements then i want to make a rule to fill out a different form on a different link. is this possible?
Question
Question
Is there a way for a date to be calculated to meet requirements for an event?
Replies
You should be able to do this using JavaScript. You would need to probably do a database lookup that would populate the event date first. Then using JavaScript, take the event date and calculate 10 days out and then see if the current date is 10 days prior to the event. I would then have the JavaScript fill in another field with a yes or no value depending on the answer. Depending on that value, I would then use JavaScript to disable the submit button and show a custom html field that contains the link you want them to click on for the other form.
Is there any way you could show me what the java script would look like for example if I want to take the submit_date from one form and on the next form have a due_date equal to the submit_date + 20 days?
$(document).ready(function(){
//set due_date to today plus 20
var dueDate = $('submit_date input').datepicker('getDate','+20d');
dueDate.setDate(dueDate.getDate()+20);
$('due_date input').datepicker('setDate', dueDate);
}) //close document.ready