You can allow users to edit a single entry or multiple entries. Insert an edit link on any page, post, or custom display to lead users back to the form to edit or update an entry.
Follow these steps if you would like each user to submit only one entry. After the user has submitted the form for the first time, they can return to the form and make any changes they would like. When a logged-in user returns to the form, it will be populated with their previous responses which they can edit and resubmit.
- Go to “Forms” → the name of your form → “Settings”.
- Check the “Only Logged-in Users Can See and Submit this Form” box. There may be some cases where you choose not to select this option.
- Check the “Allow Logged-in Users to Edit Previous Responses” box.
- Check the “Allow Only One Entry for Each Logged-in User” box.
- That’s it! Now when a user returns to a previously submitted form, they will be presented with the form already populated with their responses. When they update this form, they will be editing their previous responses instead of creating a new entry.
Follow these steps if your users will be submitting the same form multiple times and you would like to allow them to edit any of their submissions. After the user has submitted the form, they can return to the form to edit an entry by clicking an edit link or by selecting an entry from a list of previous entries.
- Follow steps 1-3 above.
- Now you need to add an edit link or a list of previous entries to allow users to edit their past responses.
- To add a list of the previously submitted entries, insert the following shortcode: [frm-entry-links id=x] where x is the id number for this form. If you place this on a different page from your form, add page_id=y, where y is the id of the page that contains your form. This shortcode will default to a list of entry creation dates. When the user clicks on one of these dates, the form will populate with their responses from that date. For customization of the entry list, see how to add a List of Entries to a page.
- To add an edit link on a page or post, use this shortcode: [frm-entry-edit-link id=x label="Edit" page_id=2]. To add an edit link to a custom display, use [editlink location="front" label="Edit" page_id=2]. Replace ’2′ with the id of the page that holds the form. These shortcodes and their customizations are described in more detail below.
Add an Edit Link
You may insert an edit link on any page, post, or custom display to allow users to easily edit or update an entry. Before an edit link will work correctly, you need to set up your form to allow editing for a Single Entry or Multiple Entries.
NOTE: The edit link will only show on the page for those authorized to edit the entry–these permissions can be modified on the form settings page
There are two forms of this shortcode. One is for use within pages, posts, and widgets. The other is for use within custom displays.
In pages, posts, or widgets
[frm-entry-edit-link id=x label="Edit" page_id=y]
‘x’= ID of the entry to be edited, or “current” (see id in the parameter list below for more info)
‘y’= ID of the page where the form is published (see page_id in the parameter list below for more info)
In custom displays
[editlink location="front" label="Edit" page_id=y]
‘y’ = ID of the page the form resides on
The following parameters can be used with both of the shortcodes mentioned above.
- id – The ID of the entry to edit (not needed for [editlink]). This ID can be found by going into your form and clicking on “Entries”. The furthest left column typically contains the entry IDs.
If you are inserting this link directly on a post page that was created by Formidable, you can use id=”current” to dynamically get the ID of the entry from the post being viewed.
- page_id – The ID of the page where the form is published. You can find the ID of a page by going into edit the page and looking in the address bar as shown below. If the page_id is not specified, this defaults to the current page ID.
- label – Change the text of the edit link (by default, it is Edit). Use label=0 to remove any HTML from the front-end link. Example: [frm-entry-edit-link id=x label="Edit" page_id=2]
- class – If you are using the label parameter, you can add an HTML class to the edit link to add styling. [frm-entry-edit-link id=x label="Edit" class="my_edit_class" page_id=2]
- form_id (not for [editlink]) – The ID of the form the entry comes from. Including this parameter will cut out a little processing time. [frm-entry-edit-link id=x label="Edit" form_id=y page_id=2]
- location (for [editlink] only) – By default, the edit link sends the user to the back-end of the entry to edit. If you would like to send the user to the front-end of the entry, include location=”front”. Example: [editlink location="front" label="Edit" page_id=2]
- prefix (Advanced) – If you want to edit the entry in place (as seen in the help desk), include the prefix of the containing div. The div should have an id like <div id=”frm_container_25″> where 25 is the entry ID. In a custom display, this would be <div id=”frm_container_[id]“>. When clicked, this will replace everything inside of this div with the form to edit. Unlike the delete link, the edit link should go outside of the container. This will allow the cancel link to show when in edit mode.
[frm-entry-edit-link id=x label="Edit" cancel="Cancel" prefix="frm_container_"] <div id="frm_container_[id]"> Content here </div>
- cancel – If using the prefix parameter, you can change the label on the cancel link. By default, the link will say “Cancel”. Example: [frm-entry-edit-link id=x label="Edit" cancel="Cancel" prefix="frm_container_"]
echo FrmProEntriesController::entry_edit_link(array('id' => x, 'label' => 'Edit', 'page_id' => y));
Replace ‘x’ with the ID of the entry to edit and replace ‘y’ with the ID of the page the form resides on.
Insert a Link to Update a Field
If you would like to provide a link to your users which allows them to update a single field without returning to the form, see Insert a Link to Update a Field.
Editing Imported Entries
If you want users to be able to edit entries that were imported by a different user (e.g. Site Administrator) you need to either edit the wp_frm_items table and assign the correct WordPress user_id to the user_id and updated_by columns, or go through and edit each entry and select the correct user from the users drop-down.