<p>The issue is you don't have a variable named <code>input</code>. I changed the code a little by included a variable named <code>value</code>. To make sure the proper option is selected you would need to pass back to the template a url param <code>name</code> with the currently selected option value.  If there is a param and it has a value it will add that value to the variable <code>value</code> if not <code>value</code> will be blank.</p>

<pre><code>&lt;label&gt;Position Applying For&lt;/label&gt;
{% set value = craft.request.getParam("name")?? "" %}
&lt;select name="{{ positionApplyingFor.handle }}"&gt;
    {% for entry in craft.entries.section('careers') %}
        &lt;option value="{{ entry.title }}" {% if value == entry.title %}selected{% endif %}&gt;
            {{ entry.title }}
        &lt;/option&gt;
    {% endfor %}
&lt;/select&gt;
</code></pre>

CC BY-SA 3.0
2017-01-17T09:28:38.773Z
Hi, thanks for your help.  It seems that on submission the FreeForm ignores whatever Labels and Values are shown on the front end in favour of whatever is added to the Select field in the Composer - even if left blank.  I tried adding tags but it just gives me tags back.    Is it actually possible to have a dynamic Select menu?
Martin
CC BY-SA 3.0
2017-01-18T14:49:33.610Z
This is possible.  In the past I have setup a route then using javascript to call the route via ajax to retrieve the new options and append them to the select node element.
a-am
CC BY-SA 3.0
2017-01-19T16:36:00.190Z
If you're using a Select field type for the field, you would need to use a Text field type instead, as Select/Checkbox Group/Radio fields do not allow dynamic values at this time. This is something however, that we may add in the future though. :)
Solspace
CC BY-SA 3.0
2017-01-19T16:42:55.683Z
No, i'm just trying to pull the Entry Title from the "careers" Section.  This is working fine on the Front End but the values are not pulled through to the 'Submissions".
Martin
CC BY-SA 3.0
2017-01-19T16:53:33.233Z
You mean when you view the submission in the CP, the value does not show for it? What type of field is it?
Solspace
CC BY-SA 3.0
2017-01-20T09:17:52.657Z
Hi, it's just a plain text field... the default 'Title' field.
Martin
CC BY-SA 3.0
2017-01-22T09:57:38.867Z
Bump:  Might be better if I explain the context.  I have a careers section with a generic application form.  Each job is an entry.  On the form I have a Select menu where the applicant can select which job they're applying for.  I have this side working, however whatever is selected is not pulling through to the admin, the values are being dropped for whetever default value has been added in the composer, even if no values have been added (blank).
Martin
CC BY-SA 3.0
2017-01-22T11:37:02.783Z
Sorry: An update on this...   It seems the Select field value IS being used and can be seen on the submissions listing page in the admin.   It is NOT shown when viewing an individual submission OR being passed into the notification email.
Martin
CC BY-SA 3.0
2017-01-16T20:28:54.593Z
2017-01-17T01:35:18.537Z
2017-01-17T01:35:18.537Z
a-am
<p>Im trying to use entry titles as options in a select field, <a href="https://solspace.com/craft/freeform/docs/formatting-templates/" rel="nofollow noreferrer">similar to the last example on this page in the docs</a></p>

<p>My code looks like this:</p>

<pre><code>&lt;label&gt;Position Applying For&lt;/label&gt;
&lt;select name="{{ positionApplyingFor.handle }}"&gt;
{% for entry in craft.entries.section('careers') %}
  &lt;option value="{{ entry.title }}"&gt;
    {{ entry.title }}
  &lt;/option&gt;
{% endfor %}
&lt;/select&gt;
</code></pre>

<p>Although the form submits, the fields content is not shown in the admin.</p>

<p>If I add {% if field.value == entry.handle %} selected{% endif %}, I get the error "Variable "field" does not exist"</p>

<p>Any help appreciated!</p>

<p>Martin</p>

<plugin-freeform><solspace>
Loop through entry titles in a select field
# Loop through entry titles in a select field

(Asked by: username_0 on 2017-01-16)

Im trying to use entry titles as options in a select field, similar to the last example on this page in the docs
My code looks like this:
Position Applying For

{% for entry in craft.entries.section('careers') %}
  
    {{ entry.title }}
  
{% endfor %}


Although the form submits, the fields content is not shown in the admin.
If I add {% if field.value == entry.handle %} selected{% endif %}, I get the error "Variable "field" does not exist"
Any help appreciated!
username_0

**Tags:** plugin-freeform, solspace


---

## 1 answers

### Answer by username_1 on 2017-01-16. Score: 3

The issue is you don't have a variable named input. I changed the code a little by included a variable named value. To make sure the proper option is selected you would need to pass back to the template a url param name with the currently selected option value.  If there is a param and it has a value it will add that value to the variable value if not value will be blank.
Position Applying For
{% set value = craft.request.getParam("name")?? "" %}

    {% for entry in craft.entries.section('careers') %}
        
            {{ entry.title }}
        
    {% endfor %}

> **Comments:**
> **username_0**: Hi, thanks for your help.  It seems that on submission the FreeForm ignores whatever Labels and Values are shown on the front end in favour of whatever is added to the Select field in the Composer - even if left blank.  I tried adding tags but it just gives me tags back.    Is it actually possible to have a dynamic Select menu?  
> **username_1**: This is possible.  In the past I have setup a route then using javascript to call the route via ajax to retrieve the new options and append them to the select node element.  
> **username_2**: If you're using a Select field type for the field, you would need to use a Text field type instead, as Select/Checkbox Group/Radio fields do not allow dynamic values at this time. This is something however, that we may add in the future though. :)  
> **username_0**: No, i'm just trying to pull the Entry Title from the "careers" Section.  This is working fine on the Front End but the values are not pulled through to the 'Submissions".  
> **username_2**: You mean when you view the submission in the CP, the value does not show for it? What type of field is it?  
> **username_0**: Hi, it's just a plain text field... the default 'Title' field.  
> **username_0**: Bump:  Might be better if I explain the context.  I have a careers section with a generic application form.  Each job is an entry.  On the form I have a Select menu where the applicant can select which job they're applying for.  I have this side working, however whatever is selected is not pulling through to the admin, the values are being dropped for whetever default value has been added in the composer, even if no values have been added (blank).  
> **username_0**: Sorry: An update on this...   It seems the Select field value IS being used and can be seen on the submissions listing page in the admin.   It is NOT shown when viewing an individual submission OR being passed into the notification email.  

---

