1

Using Sprout Forms and have added the Form Name > Select a Form to the Entry's field layout. entry field layout

After I select a form on this Entry, what do I hook into to get this to display on my template? selected form in entry

I know from the documentation that you can specifically pass in the form's Handle {{ craft.sproutForms.displayForm('myForm') }}, but what do I need to do to get the drop-down form to display if there is one selected?

2
  • Hey David, can you help me understand what you are trying to do here? Am I correct in thinking that you have a Form that allows a user to create a relationship to another Form? Also, what are you expecting to be displayed in your template? Would a dropdown field that lists all the Forms you have in Sprout Forms be what you want to output? Commented Jan 28, 2016 at 21:54
  • Ignore that last comment. The question is clear. I was misreading it. Commented Jan 31, 2016 at 23:26

1 Answer 1

1

To dynamically display a Form that you've related to an Entry using a Sprout Forms Form relations field you can pass the handle of the form to the displayForm() tag in your template:

_entry.html

{% set formHandle = entry.formFieldHandle.first().handle %}

{{ craft.sproutForms.displayForm( formHandle ) }}

There is a doc page that describes this here: Relations Field on Entry Page and depending on where you want to redirect the user after they submit the form, Sprout Forms also supports relative redirects.

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.