Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{{ select_var:label }} is not working #2066

Closed
twd3 opened this issue Jul 12, 2020 · 6 comments · Fixed by #4257
Closed

{{ select_var:label }} is not working #2066

twd3 opened this issue Jul 12, 2020 · 6 comments · Fixed by #4257
Labels

Comments

@twd3
Copy link

twd3 commented Jul 12, 2020

To get the labels of the select field you do {{ select_var:label }}. This is not outputting anything. I can get the default of value working with {{ select_var }}.

Make a select with key and label options. Try to use in template like email or on a form submission tag with {{ select_var }}, it works, now try and do with {{ select_var:label }}, it outputs nothing.

Side note: I tried this as well: {{ select_var }}{{ label }}{{ /select_var }}

On docs there is a typo too. https://statamic.dev/fieldtypes/select#templating

<p id="{{ select }}"> Oh yeah? {{ select:value }}</p> <<< This is the same thing...I think you want this:
<p id="{{ select }}"> Oh yeah? {{ select:label }}</p>

Statamic version: 3.0.0.-beta-37

PHP version: 7.3

Install method:

  • Fresh install from statamic/statamic
@twd3
Copy link
Author

twd3 commented Jul 12, 2020

Could this be happening because in the blueprint in the options array it wraps the labels in single quotes? I see in the doc's they are double quotes.

@twd3
Copy link
Author

twd3 commented Jul 13, 2020

Just FYI, I have a select field that has multi true and it is outputting the label with: {{ select_var }}{{ label }}{{ /select_var }} only difference is multiple true.

@jasonvarga
Copy link
Member

This appears to be resolved. Let us know if you're still running into this issue.

@twd3
Copy link
Author

twd3 commented Sep 25, 2020

Still having an issue or an issue with understanding...https://discord.com/channels/489818810157891584/489819906540568593/759143098893992007

@jasonvarga
Copy link
Member

I missed that you said it's in a form email. Maybe that's why it's not working for you.

@jasonvarga jasonvarga reopened this Sep 25, 2020
@twd3
Copy link
Author

twd3 commented Sep 25, 2020

Here is what I'm doing with the form:submission

{{ form:set is="contact" }}
{{ form:submission }}
{{ first_name }} {{ last_name }}
{{ if case_type_con }}
{{ case_type_con:label }}
{{ /if }}
{{ hearabout:label }}
{{ /form:submission }}
{{ /form:set }}

Then in the HTML email view it's just the normal {{ hearabout:label }}

When I use {{ hearabout }} it DOES render the value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants