Answers.Body: <p>You can pass values from other Craft elements or from URL segments, etc to your Freeform forms. Specifically when using with the <a href="http://docs.solspace.com/craft/freeform/v2/overview/fieldtype.html" rel="nofollow noreferrer">Element fieldtype</a>, when wanting to <a href="http://docs.solspace.com/craft/freeform/v2/template-objects/form.html#prop-custattr-returnurl" rel="nofollow noreferrer">override the return URL</a>, you can do something like this:</p>
  
  <pre><code>{{ form.renderTag({
    returnUrl: entry.thankyouUrl
  }) }}
  </code></pre>
  
  <p>When wanting to <a href="http://docs.solspace.com/craft/freeform/v2/template-objects/form.html#prop-custattr-overridevalues" rel="nofollow noreferrer">override Freeform field data values or options</a>, you can do something like this:</p>
  
  <pre><code>{{ form.renderTag({
     overrideValues: {
        hiddenFieldHandle: entry.id,
        stateSelect: "AZ",
        availability: ["tue", "thu"],
     }
  }) }}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-21T05:56:30.100Z
Answers.LastActivityDate: 2019-01-21T05:56:30.100Z
Answers.UserDisplayName: Solspace
Body: <p>I have an Freeform entry field <code>{{ pageForm }}</code> where the user can select a form to display on the page. </p>
  
  <p>And then in the page template I load the form in to the page using <code>{{ entry.pageForm.render() }}</code>. Cool.</p>
  
  <p>I also want them to be able to choose the return URL from an Entries field e.g <code>{{ entry.formThankyouUrl }}</code>. Is there any way to pass that formThankyouUrl to the renderTag? E.g the below setup would be ideal..</p>
  
  <p><strong>Page template:</strong></p>
  
  <pre><code>{% if entry.formPageForm|length %}
     {% set thankyouUrl = row.formThankYou.one() ?? null %}
     {{ entry.formPageForm.render() }}
  {% endif %}
  </code></pre>
  
  <p><strong>Form template:</strong></p>
  
  <pre><code>{{ form.renderTag({
    returnUrl: thankyouUrl
  }) }}
  </code></pre>
  
  <p>The reason I ask is that the default Return URL functionality in freeform is quite limited in that you have to paste in the URL, would be good to select it form a entries dropdown</p>
  
  <p>Thanks</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-12-09T01:03:53.717Z
Comments.Text: Are you using Ajax to update the page and bring in the form the user selects, or just unhiding the form? If so, on thankYouUrl field update on the page, update the return URL with JavaScript. Or, if you mean user = Craft user editing entry and selecting form, you can have the template check if thankyouurl has value and pass the custom return in the render parameters (https://solspace.com/craft/freeform/docs/freeform.form/#render)
Comments.UserDisplayName: Chattervast
Tags: <plugin-freeform><solspace><freeform>
Title: Solspace Freeform pass variable to form
ThreadText: # Solspace Freeform pass variable to form
  
  (Asked by: username_0 on 2018-12-06)
  
  I have an Freeform entry field `{{ pageForm }}` where the user can select a form to display on the page.
  
  And then in the page template I load the form in to the page using `{{ entry.pageForm.render() }}`. Cool.
  
  I also want them to be able to choose the return URL from an Entries field e.g `{{ entry.formThankyouUrl }}`. Is there any way to pass that formThankyouUrl to the renderTag? E.g the below setup would be ideal..
  
  **Page template:**
  
  ```
  {% if entry.formPageForm|length %}
     {% set thankyouUrl = row.formThankYou.one() ?? null %}
     {{ entry.formPageForm.render() }}
  {% endif %}
  
  ```
  
  **Form template:**
  
  ```
  {{ form.renderTag({
    returnUrl: thankyouUrl
  }) }}
  
  ```
  
  The reason I ask is that the default Return URL functionality in freeform is quite limited in that you have to paste in the URL, would be good to select it form a entries dropdown
  
  Thanks
  
  **Tags:** plugin-freeform, solspace, freeform
  
  > **Comments:**
  > **username_1**: Are you using Ajax to update the page and bring in the form the user selects, or just unhiding the form? If so, on thankYouUrl field update on the page, update the return URL with JavaScript. Or, if you mean user = Craft user editing entry and selecting form, you can have the template check if thankyouurl has value and pass the custom return in the render parameters (https://username_2.com/craft/freeform/docs/freeform.form/#render)  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2019-01-21. Score: 1 | Accepted answer
  
  You can pass values from other Craft elements or from URL segments, etc to your Freeform forms. Specifically when using with the [Element fieldtype](http://docs.username_2.com/craft/freeform/v2/overview/fieldtype.html), when wanting to [override the return URL](http://docs.username_2.com/craft/freeform/v2/template-objects/form.html#prop-custattr-returnurl), you can do something like this:
  
  ```
  {{ form.renderTag({
    returnUrl: entry.thankyouUrl
  }) }}
  
  ```
  
  When wanting to [override Freeform field data values or options](http://docs.username_2.com/craft/freeform/v2/template-objects/form.html#prop-custattr-overridevalues), you can do something like this:
  
  ```
  {{ form.renderTag({
     overrideValues: {
        hiddenFieldHandle: entry.id,
        stateSelect: "AZ",
        availability: ["tue", "thu"],
     }
  }) }}
  
  ```
  
  
  ---
  
  