Smarty html_options

Posted by SeanJA on Stack Overflow See other posts from Stack Overflow or by SeanJA
Published on 2010-03-24T17:14:46Z Indexed on 2010/03/24 17:23 UTC
Read the original article Hit count: 362

For smarty's html_options function, is there a way to avoid having to do this (other than not using smarty that is)?

{if $smarty.post}
    {html_options name=option_1 optins=$options selected=$smarty.post.option_1}
{else}
    {html_options name=option_1 optins=$options}
{/if}

I realize that it won't show up in the template, but it seems like a bad practice to leave something that is not defined in the template (it also fills up my error logs with noise about undefined indexes).

© Stack Overflow or respective owner

Related posts about smart

Related posts about html-options