Retaining seltected option
Hi,
I have 3 elect boxes and would like to add a 'selected' class after it has been selected, is this possible?
Country
Please Select
{exp:low_options:country}
{options}{option:label}{/options}
{/exp:low_options:country}
Replies
Low 24 Mar 2014 17:51
Do you mean inside Low Search? Then you can use a conditional like this:
Or if it has multiple options:
Ross Hulford 25 Mar 2014 09:35
Hi,
Trying this but getting an error
{exp:low_options:country}
{options}{option:label}
{/options}
Low 25 Mar 2014 09:38
What error message is that? Some HTML is stripped out. To avoid, you can use http://pastie.org/ or http://pastebin.com/ for large chunks of code.
Ross Hulford 25 Mar 2014 09:43
sorry here is the full form
http://pastie.org/8966743
Low 25 Mar 2014 09:45
If you're encoding the query in the URI, you will need to add the query="" parameter to the Form tag, so it can remember the search query.
You're also missing a closing curly bracket. It should be this:
Ross Hulford 25 Mar 2014 10:21
Still getting the error
Parse error: syntax error, unexpected 'FALSE' (T_STRING)
It looks ok
http://pastie.org/8966827
Low 25 Mar 2014 10:26
Make sure the query="" parameter points to the encoded query in the URI, eg. query="{segment_3}" (or {segment_2}, if that's the case).
Also, not seeing any conditionals in that last pastie you shared.
Ross Hulford 25 Mar 2014 10:51
sorry here it is
http://pastie.org/8966895
The problem seems to be with {option:value}
Low 25 Mar 2014 10:53
Can you try this instead?
Ross Hulford 25 Mar 2014 11:19
So I encoded the url.
http://pastie.org/8966936
I have no errors adding the '{option:value}' but it does not retain the value
Low 25 Mar 2014 11:26
As I said, you need to add query="{segment_3}" to the Form tag if you're encoding the query. Your code currently doesn't have it, so it has no way of knowing what was submitted.