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.

  • Are you sure your entry does not contain useful values? Sometimes they are just difficult to spot when you dump the object Commented Jul 13, 2018 at 7:28
  • 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? Commented Jul 13, 2018 at 13:52
  • 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? Commented Jul 13, 2018 at 18:08
  • This function can be called via {% do craft.app.getContent().populateElementContent(entry) %} it could be they lazy load it for certain reasons Commented Jul 13, 2018 at 18:11

1 Answer 1


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.