Scenario: Form is submitted creating entry #1. A special link brings user to the same form pre-filled with entry #1 values. Form is submitted, updates entry #1 with changed values, confirmations and notifications are processed again.
I only need help with the second submission, how to overwrite the original entry, without creating a second entry. I tried doing this multiple ways, the biggest hiccup involved file upload fields.
Thanks for the reply Chris! Yes, that filter works and it was part of my initial attempts. What can I do about a file upload field? If entry #1 has file uploads, how can I output them pre-filled in a way that won’t erase/overwrite the uploads from entry #1?
When presenting entry #1 for review, I’m using the gform_field_content filter to output a hidden field (and iframes displaying the actual files, but that’s besides the point). The hidden field is not working, as the second submission results in the file upload field being cleared. Here’s the code:
//... code during gform_pre_render hook, entry #1 is located
$files = rgar($entry, $field->id) ) ) { // File Upload field
add_filter( "gform_field_content_{$form['id']}_" . $field->id, function ( $content, $field, $value, $entry_id, $form_id ) use ($files) {
$content = '<input type="hidden" value="'.urlencode($files).'" name="input_'.$field->id.'" id="field_'.$form_id.'_'.$field->id.'">';
//...additional $content...
return $content;
}, 10, 5);
I’ve successfully used the gform_save_field_value filter to short-circuit overwriting the entry values (by returning an empty array), and this works! However, the result is an incomplete entry object that interferes with confirmations and notifications.
I think you are going to run into issues with browser security when attempting to pre-fill a file upload field. I’ll leave this open in case anyone can add any information.
Have you looked at what Gravity Flow provides? I could interpret what you are asking to do in a couple different ways as it relates to multiple submissions affecting one entries’ values…
Form 1 having a user input step followed by a notification step.
In this way you don’t need an actual second entry and the latest updated values are always stored in entry #1.
Form Connector Extension with Update an Entry step and Delete Entry step
In this way you have a full second submission. You’d need some way to make the association between entry 1 and entry 2 perhaps by passing via query string for hidden field.
Our support team is available to help you if you get stuck on any initial implementation issues.