ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Presetting a select box option within an entries tag

October 30, 2007 4:56pm

Subscribe [0]
  • #1 / Oct 30, 2007 4:56pm

    RipeMedia

    62 posts

    I want to be able to preset a select box option where the options are being created from an entries tag. The value being passed into the embedded template DOES exist and DOES match once of the entry titles, but the select box isn’t being preset:

    {assign_variable:my_value="{embed:value}"}
    {exp:weblog:entries weblog="system_names"}            
      <option value="{title}" {if title == my_value}SELECTED{/if} >{title}</option>
    {/exp:weblog:entries}

    Can anyone assist on this ? - thx

  • #2 / Oct 30, 2007 5:01pm

    RipeMedia

    62 posts

    NEVER MIND, I did this before and forgot what the solution was:

    {assign_variable:my_value="{embed:value}"}
    {exp:weblog:entries weblog="system_names"}            
      <option value="{title}" <?php if ('{title}' == '{my_value}') { echo 'SELECTED'; } ?> >{title}</option>
    {/exp:weblog:entries}
.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases