Answers.Body: <p>It's giving you errors because you put the variable in quotes. Ditch the quotes and try it like this...</p>
  
  <pre><code>{% set form = craft.formBuilder2.getFormByHandle(entry.formName) %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-31T04:32:13.960Z
Answers.Text: When I do that I get Internal Server Error "Trying to get property of non-object"
Answers.UserDisplayName: kingkelly
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-31T04:32:59.363Z
Answers.Text: What is `block`? I assumed that was a matrix block (or similar).
Answers.UserDisplayName: Lindsey D
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-31T04:37:58.163Z
Answers.Text: sorry, its just a good ole Plain Text field
Answers.UserDisplayName: kingkelly
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-31T04:39:45.417Z
Answers.Text: Updated my example. Assuming you're on a normal entry page, change `block` to `entry`.
Answers.UserDisplayName: Lindsey D
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-31T04:29:31.090Z
Answers.LastActivityDate: 2018-01-31T04:38:36.643Z
Answers.LastEditDate: 2018-01-31T04:38:36.643Z
Answers.UserDisplayName: Lindsey D
Body: <p>My template has this line that I want to update from a field in craft: </p>
  
  <pre><code>{% set form = craft.formBuilder2.getFormByHandle('schoolTrip') %}
  </code></pre>
  
  <p>I want 'schoolTrip' to be replaceable by a plain text field in craft. My plain text field is named 'formName'.</p>
  
  <pre><code>{% set form = craft.formBuilder2.getFormByHandle('block.formName') %}
  </code></pre>
  
  <p>just gives me errors.</p>
  
Tags: <templating><form><plugin-formbuilder2>
Title: Pass variable in Twig tag
ThreadText: # Pass variable in Twig tag
  
  (Asked by: username_0 on 2018-01-31)
  
  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.
  
  **Tags:** templating, form, plugin-formbuilder2
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-01-31. Score: 2 | Accepted answer
  
  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) %}
  
  ```
  
  > **Comments:**
  > **username_0**: When I do that I get Internal Server Error "Trying to get property of non-object"  
  > **username_1**: What is `block`? I assumed that was a matrix block (or similar).  
  > **username_0**: sorry, its just a good ole Plain Text field  
  > **username_1**: Updated my example. Assuming you're on a normal entry page, change `block` to `entry`.  
  
  ---
  
  