A client of mine needed his users to fill out the same form every single day, sometimes several a day, with mostly the same information. So I devised a snippet that allows you to select a date and copy all of the information from the entry (or entries) filled out on that date by that user to the new form. This is useful for forms where you only need to change the data in a field or two between submissions.
This solution is only meant to work with logged on users. The date selector form only returns entries submitted by the logged on user
This snippet works with my Continue Partial Entries plugin. Also, my previous version of this plugin was absolute crap. It’s waaaay better now
Create Date Selector Form
Set Form CSS (optional)
Add the gf_simple_horizontal class to the form settings to make it a nice clean single line form like the demo above
Disable Notifications and Submissions (optional)
You may have different needs, but I definitely did not want a notification for every time someone used the date picker. I would recommend turning off all notifications for the form. Similarly, I also did want any entries created for the date selector form. I highly recommend Gravity Wiz’s plugin GP Disable Entry Creation to accomplish this.
Install this Snippet
Add the following code to your functions.php
The code does the following:
- Replaces the default value of your date selector to the date of the most recent entry
- Replaces the confirmation with a list of entries submitted on that date (simply redirects if there’s only one entry)
- Loads the previous entry data onto the new form
At the bottom of the code, under Configuration, you need to set the options for your form. You can copy the Configuration section to use for as many forms as you’d like.
Specify the form by id for the form that you wish to copy
Specify the url of the form you wish to copy
Specify the form by id for the date selector form
Specify the field id of the date field on the date selector form. Defaults to 1
Specify the fields by id separated by spaces for any fields you wish to exclude from copying. Example:
'exclude_field_id' => '3 6 19 25'
Specify any field types separated by spaces for types you wish to exclude from copying. Example:
'exclude_type' => 'signature hidden date time'
Specify the confirmation message that appears if there are no entries that match the specified date. Defaults to
'There is no entry for this date'