X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Default drop down menu selection (https://forum.x-cart.com/showthread.php?t=38699)

glsp 03-30-2008 07:57 AM

Default drop down menu selection
 
I want the default selected item in a drop down menu to be something other than the first item in the list. Can anyone tell me why the following code doesn't work?
Code:

{* $Id: title_selector.tpl,v 1.3 2005/11/30 13:29:35 max Exp $ *}
{foreach from=$titles item=v}
        <option value="{$v.title_orig|escape}"{if $field eq $v.titleid} selected="selected"{else if $v.titleid eq 3} selected="selected"{/if}>{$v.title}</option>
{/foreach}

Thanks!

kube 03-30-2008 08:26 AM

Re: Default drop down menu selection
 
hi glsp,

For a default title try...

{foreach from=$titles item=v}
<option value="{$v.title_orig|escape}"{if $field eq $v.titleid} selected="selected"{elseif $v.titleid eq 3} selected="selected"{/if}>{$v.title}</option>
{/foreach}

'elseif' should be one word unlike 'else if'

Hope this helps.

glsp 03-30-2008 08:31 AM

Re: Default drop down menu selection
 
Bingo! That was it. Thanks so much!


All times are GMT -8. The time now is 07:38 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.