<p>If you're looking to just output the value of the PositionSelect field, it's <code>block.placement</code>.</p>

<p>See here for more info: <a href="http://buildwithcraft.com/docs/position-select-fields#templating" rel="nofollow">http://buildwithcraft.com/docs/position-select-fields#templating</a></p>

CC BY-SA 3.0
2015-06-19T06:35:43.120Z
Hi Brad. Thanks. I have actually tried that too and it's not working. Sorry about the code above, I'd momentarily converted the field into a drop-down when it wasn't working in order to see if that would work and it did but still can't get a position field to work unfortunately.
Mark Bowen
CC BY-SA 3.0
2015-06-19T17:11:16.387Z
Are you sure it actually has a value selected?
Brad Bell
CC BY-SA 3.0
2015-06-19T17:14:48.300Z
Hmm is it possible to not have one selected? It's set to left currently although I didn't actually select that it was what was set out of the box so to speak. I did try changing it from left to right a couple of times though to see if that would help as some other CMSs would sometimes not set a value for a field if you added the field in after the entry had been created and didn't resave the entry. That wasn't it though. Going to have to try this out on a different template severely cut back in terms of code and see what happens. Seems very odd at the moment though.
Mark Bowen
CC BY-SA 3.0
2015-06-19T18:12:19.530Z
Brad. Some info for you, and this one is strange. If I take out the {% switch %} tag and just output {{ block.placement }} then it spits out what it should spit out and I get left or right depending on what was selected for each block. That's all great however it seems as though I just can't get a switch tag to work with the position field. Does it work fine on anyone else's installs? It's definitely spitting out a value for that {{ block.placement }} variable but just won't work at all inside a switch tag. Please someone let me know this isn't me as I feel I'm going mad!! ;-)
Mark Bowen
CC BY-SA 3.0
2015-06-19T18:31:43.267Z
Agggh!! My original code doesn't actually show fully what I'm doing. I don't actually need the value of the {{ block.placement }} variable. What I'm trying to do is to use that within a switch to check what the value is and then spit out some code based upon that. I'll update the code above to reflect what I'm trying to do but I'm guessing that perhaps a switch can't go within a switch? If so what's my next option?
Mark Bowen
CC BY-SA 3.0
2015-06-19T18:54:19.620Z
Just tested and nested switch statements work here. Just try using a bunch of `if / else if` statements and see if that works.
Brad Bell
CC BY-SA 3.0
2015-06-19T19:20:56.947Z
Yep resorted to using 'if' statements instead for now. Really don't know why it won't work for me though. Will bring my template code to the absolute minimum a bit later on and see if I can narrow this one down.
Mark Bowen
CC BY-SA 3.0
2015-06-19T23:43:21.973Z
Well I've absolutely no idea what I did differently but it is now working!! I took absolutely everything out of my template and put in literally the simplest code possible just to test if this would work and it did!! I then placed my original code back and added those switch parts back in again and it worked! I must have had some code (probably one character knowing me) wrong somewhere but I must have looked over it about 100 times and I just couldn't see the issue anywhere :-( All good now though so thank you for looking into this for me and reassuring me that it should work as it does!! :-)
Mark Bowen
CC BY-SA 3.0
2015-06-19T00:10:32.907Z
2015-06-19T00:10:32.907Z
Brad Bell
<p>Please someone tell me where I'm going wrong with this. I have a Matrix field called Page Builder <em>(pageBuilder)</em> and have different matrix blocks for outputting information in different ways.</p>

<p>This code in the entry template works fine for every field except for the one called Placement <em>(placement)</em> which is a position select field. I can't for the life of me get it to output anything at all :-(</p>

<p>Please tell me where I'm going wrong on this one as I'm sure it's going to be something stupid with my code syntax somewhere but just can't tell where for the life of me!!</p>

<pre><code>{% for block in entry.pageBuilder %}

{% switch block.type %}

    {% case "textBlock" %}

        {{ block.text }}

    {% case "callToAction" %}

        &amp;lt;h3&amp;gt;{{ block.blockColour }}&amp;lt;/h3&amp;gt; {{ block.text }}

    {% case "sectionBlock" %}

        {{ block.text}}

    {% case "threeColumn" %}

        {{ block.column1 }}
        {{ block.column2 }}
        {{ block.column3 }}

    {% case "smallColumnLargeColumn" %}

        {# CAN'T GET THIS NEXT BIT WORKING #}
        {% switch block.placement %}
                {% case "left" %}
                &lt;p&gt;Code to output if left&lt;/p&gt;
                {% case "right" %}
                &lt;p&gt;Code to output if right&lt;/p&gt;
        {% endswitch %}
        {# ----------------------------------- #}

        {{ block.column1 }}
        {{ block.column2 }}

{% endswitch %}
{% endfor %}
</code></pre>

<output><position>
Unable to output position select value
# Unable to output position select value

(Asked by: username_0 on 2015-06-18)

Please someone tell me where I'm going wrong with this. I have a Matrix field called Page Builder (pageBuilder) and have different matrix blocks for outputting information in different ways.
This code in the entry template works fine for every field except for the one called Placement (placement) which is a position select field. I can't for the life of me get it to output anything at all :-(
Please tell me where I'm going wrong on this one as I'm sure it's going to be something stupid with my code syntax somewhere but just can't tell where for the life of me!!
{% for block in entry.pageBuilder %}

{% switch block.type %}

    {% case "textBlock" %}

        {{ block.text }}

    {% case "callToAction" %}

        <h3>{{ block.blockColour }}</h3> {{ block.text }}

    {% case "sectionBlock" %}

        {{ block.text}}

    {% case "threeColumn" %}

        {{ block.column1 }}
        {{ block.column2 }}
        {{ block.column3 }}

    {% case "smallColumnLargeColumn" %}

        {# CAN'T GET THIS NEXT BIT WORKING #}
        {% switch block.placement %}
                {% case "left" %}
                Code to output if left
                {% case "right" %}
                Code to output if right
        {% endswitch %}
        {# ----------------------------------- #}

        {{ block.column1 }}
        {{ block.column2 }}

{% endswitch %}
{% endfor %}

**Tags:** output, position


---

## 1 answers

### Answer by username_1 on 2015-06-19. Score: 2

If you're looking to just output the value of the PositionSelect field, it's `block.placement`.

See here for more info: <http://buildwithcraft.com/docs/position-select-fields#templating>

> **Comments:**
> **username_0**: Hi Brad. Thanks. I have actually tried that too and it's not working. Sorry about the code above, I'd momentarily converted the field into a drop-down when it wasn't working in order to see if that would work and it did but still can't get a position field to work unfortunately.  
> **username_1**: Are you sure it actually has a value selected?  
> **username_0**: Hmm is it possible to not have one selected? It's set to left currently although I didn't actually select that it was what was set out of the box so to speak. I did try changing it from left to right a couple of times though to see if that would help as some other CMSs would sometimes not set a value for a field if you added the field in after the entry had been created and didn't resave the entry. That wasn't it though. Going to have to try this out on a different template severely cut back in terms of code and see what happens. Seems very odd at the moment though.  
> **username_0**: Brad. Some info for you, and this one is strange. If I take out the {% switch %} tag and just output {{ block.placement }} then it spits out what it should spit out and I get left or right depending on what was selected for each block. That's all great however it seems as though I just can't get a switch tag to work with the position field. Does it work fine on anyone else's installs? It's definitely spitting out a value for that {{ block.placement }} variable but just won't work at all inside a switch tag. Please someone let me know this isn't me as I feel I'm going mad!! ;-)  
> **username_0**: Agggh!! My original code doesn't actually show fully what I'm doing. I don't actually need the value of the {{ block.placement }} variable. What I'm trying to do is to use that within a switch to check what the value is and then spit out some code based upon that. I'll update the code above to reflect what I'm trying to do but I'm guessing that perhaps a switch can't go within a switch? If so what's my next option?  
> **username_1**: Just tested and nested switch statements work here. Just try using a bunch of `if / else if` statements and see if that works.  
> **username_0**: Yep resorted to using 'if' statements instead for now. Really don't know why it won't work for me though. Will bring my template code to the absolute minimum a bit later on and see if I can narrow this one down.  
> **username_0**: Well I've absolutely no idea what I did differently but it is now working!! I took absolutely everything out of my template and put in literally the simplest code possible just to test if this would work and it did!! I then placed my original code back and added those switch parts back in again and it worked! I must have had some code (probably one character knowing me) wrong somewhere but I must have looked over it about 100 times and I just couldn't see the issue anywhere :-( All good now though so thank you for looking into this for me and reassuring me that it should work as it does!! :-)  

---

