I have a form that allows for users to report time worked. In it, they must select a week ending date. Here is my problem: I've been asked to show a radio button with confirmation of that date (a simple "Yes, I meant to select that day and "No, I did not") if the date selected is more than two weeks out from the current date. Here is where I believe JavaScript will be needed, of which I am a relative novice, and could use the help! Is there a way to show a required field in Forms only if the date selected is more than two weeks out from today's date?
Question
Question
Showing Fields Based On Calendar Date
Answer
Hi Ryan
You could do this using Javascript or by creating another field with a Calculation in it to create the validation you choose, which would return either a Yes or No response.
Your formula would use DATEDIF for the Validation, and Return Yes or No as the result.
=IF((DATEDIF(YourDateField,NOW(),"D"))>14,"Yes","No")
Reads as: if the number of Days from the date chosen and Now is greater than 14 days, Set value to "Yes", otherwise "No"
Your Field Rule would then be to hide the fields if the Result above is met your parameters
Hide Field "Pick your Field" When you calculated Field = "Yes"
You can choose to hide this field on your form as well so it's not seen on the form itself
Hey Steve, I appreciate the response! I'm testing that formula and it sounds great, happy to hear I can do that without using JS, but in practice, it's not working for me. I'll keep messing with it, but in case you know what I'm doing wrong can you point me in the right direction?
In testing, I have two fields. One is the variable Date_. The other is a single line field with your provided formula in it. It reads...
=IF((DATEDIF(Date_,NOW(),"D"))>14,"Yes","No")
When I preview the form, regardless of the day I select, 14 days out or otherwise, it turns up the result of "No." I've yet to get it to turn up a "Yes" answer.
Nevermind, I got it to work! Just needed to flip the values around - NOW first, Date_ second in that formula. Thank you!
Good catch Ryan