Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-19T06:35:43.120Z
Answers.Text: 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.
Answers.UserDisplayName: Mark Bowen
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-19T17:11:16.387Z
Answers.Text: Are you sure it actually has a value selected?
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-19T17:14:48.300Z
Answers.Text: 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.
Answers.UserDisplayName: Mark Bowen
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-19T18:12:19.530Z
Answers.Text: 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!! ;-)
Answers.UserDisplayName: Mark Bowen
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-19T18:31:43.267Z
Answers.Text: 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?
Answers.UserDisplayName: Mark Bowen
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-19T18:54:19.620Z
Answers.Text: Just tested and nested switch statements work here. Just try using a bunch of `if / else if` statements and see if that works.
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-19T19:20:56.947Z
Answers.Text: 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.
Answers.UserDisplayName: Mark Bowen
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-19T23:43:21.973Z
Answers.Text: 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!! :-)
Answers.UserDisplayName: Mark Bowen
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-19T00:10:32.907Z
Answers.LastActivityDate: 2015-06-19T00:10:32.907Z
Answers.UserDisplayName: Brad Bell
Body: <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>
  
Tags: <output><position>
Title: Unable to output position select value
ThreadText: # 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" %}
  
          &lt;h3&gt;{{ block.blockColour }}&lt;/h3&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" %}
                  <p>Code to output if left</p>
                  {% case "right" %}
                  <p>Code to output if right</p>
          {% 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 username_1. 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**: username_1. 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!! :-)  
  
  ---
  
  