Structured Page Definition, Boolean Data Type and Drop Down List, How do I use the selected value in

Robert Srigley asked on May 22, 2018 19:19

I am using the Portal Engine and created a Structured Page Type.

The field definitions include a field called InformedType which is using the Boolean Data Type and a Form Control of drop down list.

I set the Data Source to List of Options and filled in the following items; ;(Select)
1;Alerts
2;Announcements
3;Education
4;Events
5;Healthy Workplace
6;News

Is this the correct format?

I added a page to my site using this Structured Page Definition, however I can not get the value I set my InformedType field to.

Here is the part of code where I am trying to expose the value selected;

<div class="tag-posted-in">
  <ul class="list-unstyled">
<li><i class="fa fa-tag"></i> {% InformedType %}</li>
  </ul>
 </div>

Correct Answer

Brenden Kehren answered on May 22, 2018 19:48

A Boolean data type is true/false or 1/0. For your setup, you're best bet is to use a text data type with a length of 2 OR an Integer data type.

If you use integer data type then when you go to display the values saved, it will display the 1 or 2 or whatever value the user selects in the dropdown list.

If you use a text field, you can store the actual text simply by not adding the value before it. So your setup would be Text data type, with a length of 20 and the dropdown list form conrol. In the list of options simply add:

Alerts
Announcements
Education
Events
Healthy Workplace
News

This will then store that text as the value.

Another option is to use Categories.

0 votesVote for this answer Unmark Correct answer

   Please, sign in to be able to submit a new answer.