0

I'm using Low Variables. This specific variable is of the type 'Grid'. What I'm having in my template is this:

<select name="country" id="country" class="form-control"> {exp:low_variables:pair var="var_eleads_country"} <option value="{var_eleads_country:code}">{var_eleads_country:label}</option> {/exp:low_variables:pair} </select>

In my actual template though, it doesn't work. I'm only seeing one option, with {var_eleads_country:code} as value and {var_eleads_country:label} as text.

What should I do?

EDIT: This is happening inside of a Freeform. Also, I'm using Croxton's Stash. This is the stash_template, but the Form itself is wrappen in a {stash:nocache}.

6
  • You've got a missing closing } there. Are you sure that's not it?
    – Low
    Commented Apr 15, 2015 at 13:12
  • Must be something that went wrong while copy pasting, but it's there in my actual template.
    – Rien
    Commented Apr 15, 2015 at 14:10
  • Edited and added some more info on this
    – Rien
    Commented Apr 15, 2015 at 14:34
  • And are you sure "label" is a valid Grid column name?
    – Low
    Commented Apr 16, 2015 at 6:39
  • Yes, I'm pretty sure :) In the actual case, my fields are code, en, fr and es, but I simplified it here. The issue is in the looping, there's about 50 countries in this grid, but the parsed html is only like this: <select name="country" id="country" class="form-control"> <option value="{var_eleads_country:code}">{var_eleads_country:en}</option> </select>
    – Rien
    Commented Apr 16, 2015 at 7:56

1 Answer 1

1

Alright, I did a fix.

I renamed my en, fr and es fields with a prefix label_.

In my template I did this:

{/stash:nocache} {exp:low_variables:parse var="var_eleads_countries"} <option value="{var_eleads_countries:code}"> {var_eleads_countries:label_{segment_1}}</option> {/exp:low_variables:parse} {stash:nocache}

The nocache tag is wrapped around my form, but it's important to close it and reopen it when parsing here, because otherwise, you'll have parsing issues on the {segment_1} tag.

Also, I fixed my typ in the var (insert shame here), which had to be var_eleads_countries rather than var_eleads_country.

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.