<p>It looks like according to your code this (and Aran's) solution should work except for one small difference... if you are testing for this:</p>

<pre><code>entry.title ~ category.title
</code></pre>

<p>The value parameter (what is getting stored in the database) should match by removing the space, so from this:</p>

<pre><code>{{ entry.title }} {{ category.entryAlternativeTitle }}
</code></pre>

<p>To this:</p>

<pre><code>{{ entry.title }}{{ category.entryAlternativeTitle }}
</code></pre>

<p>Or you could also test for the space if you want:</p>

<pre><code>{% if requestTeam.value == entry.title ~ ' ' ~ category.title %}
</code></pre>

<hr>

<p>Update: Also want to note that you may need to test for the "entryAlternativeTitle" variable. Can't know for sure without seeing all of your code but if this is all being executed in the same chunk it should most likely be:</p>

<pre><code>{% if requestTeam.value == entry.title ~ ' ' ~ category.entryAlternativeTitle %}
</code></pre>

CC BY-SA 3.0
2017-08-29T04:04:33.987Z
2017-08-29T04:17:43.757Z
2017-08-29T04:17:43.757Z
Alan Miller
<p>Stephen to concatenate remove the quotation marks around both titles and add the tilde between them.</p>

<pre><code>{% if requestTeam.value == entry.title ~ category.title %}
</code></pre>

CC BY-SA 3.0
2017-08-29T03:56:09.117Z
2017-08-29T03:56:09.117Z
a-am
<p>I'm using Freeform Pro to manually output a select field, but I think my question is a general Craft/Twig conditional question so I'm posting it here.</p>

<p>The option values in my dropdown field are made up of two variables outputted together - an entry title and a category title.</p>

<p>I'm trying to add a conditional for the 'selected' state of the dropdown but I can't get the conditional to work as I'm not sure of the proper syntax to for a concatenated value like this.</p>

<p>I've tried each of the following but none of them work:</p>

<pre><code>&lt;option value="{{ entry.title }} {{ category.entryAlternativeTitle }}" {% if requestTeam.value == 'entry.title category.title' %}selected{% endif %}&gt;{{ entry.title }} {{ category.entryAlternativeTitle }}&lt;/option&gt;

&lt;option value="{{ entry.title }} {{ category.entryAlternativeTitle }}" {% if requestTeam.value == entry.title category.title %}selected{% endif %}&gt;{{ entry.title }} {{ category.entryAlternativeTitle }}&lt;/option&gt;

&lt;option value="{{ entry.title }} {{ category.entryAlternativeTitle }}" {% if requestTeam.value == entry.title ~ category.title %}selected{% endif %}&gt;{{ entry.title }} {{ category.entryAlternativeTitle }}&lt;/option&gt;

&lt;option value="{{ entry.title }} {{ category.entryAlternativeTitle }}" {% if requestTeam.value == {{ entry.title }} {{ category.title }} %}selected{% endif %}&gt;{{ entry.title }} {{ category.entryAlternativeTitle }}&lt;/option&gt;
</code></pre>

<p>Thanks for any help with this.</p>

CC BY-SA 3.0
2017-08-30T13:25:58.617Z
let us know if you were able to get this sorted out! Thanks!!
Alan Miller
<templating><conditional><plugin-freeform>
How to add two variables into one conditional
# How to add two variables into one conditional

(Asked by: username_0 on 2017-08-29)

I'm using Freeform Pro to manually output a select field, but I think my question is a general Craft/Twig conditional question so I'm posting it here.
The option values in my dropdown field are made up of two variables outputted together - an entry title and a category title.
I'm trying to add a conditional for the 'selected' state of the dropdown but I can't get the conditional to work as I'm not sure of the proper syntax to for a concatenated value like this.
I've tried each of the following but none of them work:
{{ entry.title }} {{ category.entryAlternativeTitle }}

{{ entry.title }} {{ category.entryAlternativeTitle }}

{{ entry.title }} {{ category.entryAlternativeTitle }}

{{ entry.title }} {{ category.entryAlternativeTitle }}

Thanks for any help with this.

**Tags:** templating, conditional, plugin-freeform

> **Comments:**
> **username_1**: let us know if you were able to get this sorted out! Thanks!!  

---

## 2 answers

### Answer by username_1 on 2017-08-29. Score: 2

It looks like according to your code this (and Aran's) solution should work except for one small difference... if you are testing for this:
entry.title ~ category.title

The value parameter (what is getting stored in the database) should match by removing the space, so from this:
{{ entry.title }} {{ category.entryAlternativeTitle }}

To this:
{{ entry.title }}{{ category.entryAlternativeTitle }}

Or you could also test for the space if you want:
{% if requestTeam.value == entry.title ~ ' ' ~ category.title %}


Update: Also want to note that you may need to test for the "entryAlternativeTitle" variable. Can't know for sure without seeing all of your code but if this is all being executed in the same chunk it should most likely be:
{% if requestTeam.value == entry.title ~ ' ' ~ category.entryAlternativeTitle %}


---

### Answer by username_2 on 2017-08-29. Score: 1

username_0 to concatenate remove the quotation marks around both titles and add the tilde between them.
{% if requestTeam.value == entry.title ~ category.title %}


---

