【问题标题】:Smarty {html_radio} how to make it required?Smarty {html_radio} 如何使它成为必需的?
【发布时间】:2016-04-17 01:01:26
【问题描述】:

我正在寻找如何使用 smarty 自定义函数 {html_radio} http://www.smarty.net/docs/en/language.function.html.radios.tpl

制作所需的单选按钮组

这是我的代码:

{html_radios name='radio' options=$radio_options separator='<br />'}

谢谢。

【问题讨论】:

    标签: html radio-button smarty prestashop


    【解决方案1】:

    从 tools/smarty/ 挖掘到 function.html_radios.php 并看到 $extra 变量。

    if (!is_array($_val)) {
       $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
    }
    

    另外,在http://www.smarty.net/docs/en/language.function.html.radios.tpl 中,请参阅“严格”属性。

    所以,我的代码看起来像:

    {html_radios required='required' name='radio' options=$radio_options separator='<br />'}
    

    而且效果很好。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-13
      • 2014-09-14
      • 2015-12-16
      • 2016-09-18
      相关资源
      最近更新 更多