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}.

  • You've got a missing closing } there. Are you sure that's not it? – Low Apr 15 '15 at 13:12
  • Must be something that went wrong while copy pasting, but it's there in my actual template. – Rien Apr 15 '15 at 14:10
  • Edited and added some more info on this – Rien Apr 15 '15 at 14:34
  • And are you sure "label" is a valid Grid column name? – Low Apr 16 '15 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 Apr 16 '15 at 7:56
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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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