0

What is the correct syntax for setting the selected year drop down upon a search?

{exp:low_events:archive 
                events_field="events_date_time" 
                show_passed="no" 
                show_future_entries="yes"
                unit='year'
            }
<option {if low_search_low_events:date == date_url} selected="selected"{/if} value="{year}">{year}</option>
{/exp:low_events:archive}

This works when unit is set to month, but not year.

1

The value of the option is the {year} val, so use year instead of date_url in your conditional.

| improve this answer | |
  • low_search_low_events:date is outputting dates in the format yyyy-mm so how does yyyy-mm == yyyy ? – BillyMedia Jun 26 '14 at 8:52
  • Then add more info to your original question. What's the name of the select element that is part of the options you're generating? Better still, what does the full Form tag look like? – Low Jun 26 '14 at 9:15

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.