0

In the CP I have a table field called colors. I have two columns, "Label" and "Value".

I have populated the table with two default values "Red" and "Blue" (attached). enter image description here

This table will ultimately populate a dropdown on the front end. Label being the label, and value being the value.

When I edit the entry that I have assigned the colors field to, the default values do not show. I can only choose "Add a row". I do want to be able to add/remove rows like this, but I'd like to have "Red" and "Blue" be there by default.

enter image description here

On the template level I create the dropdown like this:

{% if entry.colors|length %}
<select id="colors" name="colors">
    <option value="">Select</option>
    {% for color in entry.colors %}
        <option value="{{ color.value }}">{{ color.label }}</option>
    {% endfor %}
</select>
{% endif %}

The drop down does not show until I enter a value in the entry. I'm not sure what I'm doing wrong so that the drop down will pull in the default values by...default.

2
  • 1
    You will only get the defaults for new entries! Do they show up with new entries?
    – carlcs
    Commented Oct 9, 2015 at 17:31
  • What the.... I SWEAR I I TRIED THAT. ...and yet another silly question by yours truly. Post your comment as the answer and I'll check it. Thank you!!
    – Damon
    Commented Oct 9, 2015 at 18:08

1 Answer 1

2

You will only get the defaults for new entries.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.