<p>Sprout Forms improved support of this scenario in v3.0.0-beta.27. You can now use the <code>setEntry</code> variable to populate the Form Entry Model that you want to use in the Form Templates that you output using the <code>displayForm</code> tag. See the docs on <a href="https://sprout.barrelstrengthdesign.com/docs/forms/entries.html#editing-entries" rel="nofollow noreferrer">Editing Entries</a> for more info.</p>

<h3>Populate a Front-End form with existing data</h3>

<pre><code>{# Get an instance of the your Form #}
{% set form = craft.sproutForms.getForm('application') %}

{# Get an instance of the Entry you'll be allowing a user to edit #}
{% set entry = craft.sproutForms.getEntryById(123) %}

{# Set the `entry` variable so your Form Templates know how to populate the fields with existing values #}
{% do craft.sproutForms.setEntry(form, entry) %}

{# Output your form as usual #}
{{ craft.sproutForms.displayForm('application') }}
</code></pre>

<hr>

<p><strong>Original Answer</strong></p>

<p><em>I've looked into this and am considering this a bug. I've opened an <a href="https://github.com/barrelstrength/craft-sprout-forms/issues/131" rel="nofollow noreferrer">issue</a> on Github and will update my answer here when we have a fix in place.</em></p>

CC BY-SA 4.0
2018-07-17T14:07:25.727Z
2018-10-22T23:52:14.357Z
2018-10-22T23:52:14.357Z
Ben Parizek
<p>Following <a href="https://craftcms.stackexchange.com/questions/16218/sprout-forms-how-to-link-to-individual-entries-on-the-front-end">Sprout Forms -- How to link to individual entries on the front-end</a> I found code </p>

<pre><code>{% set formEntryId = craft.request.getSegment(2) %}
{% set entry = craft.sproutForms.getEntryById(formEntryId) %}
</code></pre>

<p>but it doesn't have any field data. Including <code>{{ dump(entry) }}</code> in my template shows <code>object(barrelstrength\sproutforms\elements\Entry)</code> with a lot of structure but no user entered values.</p>

<p>I was actually hoping to reuse my custom form templates (Sprout Forms > Settings > General > Default Form Templates) so it'll cycle through all the field templates like when the user filled in the form but I just want to show values if the form has already been submitted.</p>

CC BY-SA 4.0
2018-07-13T07:28:58.930Z
Are you sure your `entry` does not contain useful values? Sometimes they are just difficult to spot when you `dump` the object
Robin Schambach
CC BY-SA 4.0
2018-07-13T13:52:55.253Z
For 1, I submitted my form with a unique value in a singleline field. After getEntryById and dumping entry I can't find that unique value anywhere. For 2, I'm also trying to front end view the entry using the same form templates used to create the empty form. Each fieldtype/input.html has `value="{{ value }}"` so I should see the value there, no?
Amanda Lutz
CC BY-SA 4.0
2018-07-13T18:08:16.193Z
I'm digging right into the Sprout Forms code to see what I might be missing. File controllers/EntriesController.php has `$entry = SproutForms::$app->entries->getEntryById($entryId);` and then a few lines later `Craft::$app->getContent()->populateElementContent($entry);` before they render the edit entry template. Do I need to find a way to do that in my template to view a Sprout Forms entry?
Amanda Lutz
CC BY-SA 4.0
2018-07-13T18:11:14.970Z
This function can be called via `{% do craft.app.getContent().populateElementContent(entry) %}` it could be they lazy load it for certain reasons
Robin Schambach
<craft3><plugin-sproutforms><frontend>
Display/edit Sprout Form entry in front end
# Display/edit Sprout Form entry in front end

(Asked by: username_0 on 2018-07-12)

Following Sprout Forms -- How to link to individual entries on the front-end I found code 
{% set formEntryId = craft.request.getSegment(2) %}
{% set entry = craft.sproutForms.getEntryById(formEntryId) %}

but it doesn't have any field data. Including {{ dump(entry) }} in my template shows object(barrelstrength\sproutforms\elements\Entry) with a lot of structure but no user entered values.
I was actually hoping to reuse my custom form templates (Sprout Forms > Settings > General > Default Form Templates) so it'll cycle through all the field templates like when the user filled in the form but I just want to show values if the form has already been submitted.

**Tags:** craft3, plugin-sproutforms, frontend

> **Comments:**
> **username_1**: Are you sure your `entry` does not contain useful values? Sometimes they are just difficult to spot when you `dump` the object  
> **username_0**: For 1, I submitted my form with a unique value in a singleline field. After getEntryById and dumping entry I can't find that unique value anywhere. For 2, I'm also trying to front end view the entry using the same form templates used to create the empty form. Each fieldtype/input.html has `value="{{ value }}"` so I should see the value there, no?  
> **username_0**: I'm digging right into the Sprout Forms code to see what I might be missing. File controllers/EntriesController.php has `$entry = SproutForms::$app->entries->getEntryById($entryId);` and then a few lines later `Craft::$app->getContent()->populateElementContent($entry);` before they render the edit entry template. Do I need to find a way to do that in my template to view a Sprout Forms entry?  
> **username_1**: This function can be called via `{% do craft.app.getContent().populateElementContent(entry) %}` it could be they lazy load it for certain reasons  

---

## 1 answers

### Answer by username_2 on 2018-07-17. Score: 1 | Accepted answer

Sprout Forms improved support of this scenario in v3.0.0-beta.27. You can now use the setEntry variable to populate the Form Entry Model that you want to use in the Form Templates that you output using the displayForm tag. See the docs on Editing Entries for more info.
Populate a Front-End form with existing data
{# Get an instance of the your Form #}
{% set form = craft.sproutForms.getForm('application') %}

{# Get an instance of the Entry you'll be allowing a user to edit #}
{% set entry = craft.sproutForms.getEntryById(123) %}

{# Set the `entry` variable so your Form Templates know how to populate the fields with existing values #}
{% do craft.sproutForms.setEntry(form, entry) %}

{# Output your form as usual #}
{{ craft.sproutForms.displayForm('application') }}


Original Answer
I've looked into this and am considering this a bug. I've opened an issue on Github and will update my answer here when we have a fix in place.


---

