The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group

Slack Signup
Newsletter Optin
Help Desk

Prevent edit certain dates before the event date


This Discussion is public


Hi all!Guys, there are great hooks for frm_user_can_edit, but 1 is missing that I think could be helpful for a lot of us.Could filter "prevent editing after a certain date"  be modified to set this "certain date" with a  resting to the "datepicker" chosen date minus a quantity of days?So there will be a deadline date for editing. If was chosen Feb 15 with the datepicker in a form like a date for a service. The client can edit it until 3 days before the service date. In this example he will be able to edit until Feb 12.Hope someone could give me a hand, Thanks guys

Please clarify a few things, what do you mean by "datepicker chosen date"? Do you mean the date on the form when it is displayed in the browser before it is saved? Do you mean if the date changes while the user is editing the form in the browser? Or, do mean the date that saved in the database after the form is saved but before it is edited. The approach you take is very different depending upon what you mean by this.

Hi Victor, thanks for asking and I am sorry, I think I wrote it not clear. For example, I have 1 form with: 3 fields, Name, phone-number and "massage Date" (this is the date a person will chose while filling the form and submit it). So, what I am looking for, is that everyone could edit his information(entries) until 5 days before "the massage day". I think it looks like: edit availability until "datepicker" - 5 days. Hope you could give me a hand, thanks! PD: I think the correct name for this discussion should be "Prevent edit X days before the event date"

The approach I would take is to save the last day to edit in a hidden field on the form. You can calculate this date when the massage date is selected on the form by using a jQuery function.

By storing the last day to edit field in the form entry, it's available to you for any calculation in frm_user_can_edit or maybe even to send a reminder to your customer.

Hi Victor,

Thanks for the comments and good idea with the hidden field, you are right. I am feeling like a noob now because I dont know how to calculate a resting: "Date" minus "number". But I will investigate more, hope I could resolve this. Thanks!

Discussion closed.