1

My template has this line that I want to update from a field in craft:

{% set form = craft.formBuilder2.getFormByHandle('schoolTrip') %}

I want 'schoolTrip' to be replaceable by a plain text field in craft. My plain text field is named 'formName'.

{% set form = craft.formBuilder2.getFormByHandle('block.formName') %}

just gives me errors.

2

It's giving you errors because you put the variable in quotes. Ditch the quotes and try it like this...

{% set form = craft.formBuilder2.getFormByHandle(entry.formName) %}
  • When I do that I get Internal Server Error "Trying to get property of non-object" – kingkelly Jan 31 '18 at 4:32
  • What is block? I assumed that was a matrix block (or similar). – Lindsey D Jan 31 '18 at 4:32
  • sorry, its just a good ole Plain Text field – kingkelly Jan 31 '18 at 4:37
  • Updated my example. Assuming you're on a normal entry page, change block to entry. – Lindsey D Jan 31 '18 at 4:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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