How to allow 'edit and resend' ONLY during the same week the survey was taken?

189
3
2 weeks ago
TL2
by
Occasional Contributor III

I would like to limit users from editing a form and resubmitting by only allowing them to submit a survey the same week they collected the data.  

Currently I am taking the end type date and comparing it with the today() date to make the form read-only.

if(format-date(${today},'%W') = format-date(${enddate},'%W')

I now realize that %w does not work in calculation so the today() does not recalculate when the form is reopened in the sent folder.

Is there an alternative to this?  Maybe with a constraint?  I am not sure how to get the last date of the week the initial survey was collected.

0 Kudos
3 Replies
abureaux
MVP Regular Contributor

If you want the current week, then you may be out of luck. If you want something a little looser like within 7 days, then that should be easy enough.

Place a constraint on a hidden question. When survey is first created, create a date calculation (e.g., ${form_start_7}) to be something like today+7 days. Then, have a second hidden date question (e.g, ${date_today}) with calculationMode=always and set the default to today() so each time the survey is opened it is today's date. Then, compare the two dates in the constraint question, ensuring ${date_today} is <= ${form_start_7}

Not something I've tried to do before, but should work.

0 Kudos
TL2
by
Occasional Contributor III

Thanks, I went with something similar but I calculate the + days based on what day of the week it is, i.e. if Mon + 7, if Tues + 6....

0 Kudos
GaryBowles1
Occasional Contributor III

We limit certain surveys for editing by activating the inbox and only displaying the past ten days with a query expression: created_date between CURRENT_DATE - 8 AND CURRENT_DATE+1

This will only display surveys collected within the last ten days (backwards 9 days plus today) so these are the only surveys available to edit via the Inbox.

Regards,

--gary

0 Kudos