如何向表单标记添加无价值属性?
我想要:
<form data-abide >根据:http://foundation.zurb.com/sites/docs/abide.html
我试过了
<?php $form = ActiveForm::begin(['id' => 'contact-form', 'options'=>['data-abide'=>'']]); ?>但是得到输出:
<form data-abide="ak8hvf-abide" >发布于 2016-01-11 05:22:06
它实际上是按照预期的行为--原来是adide.js添加了额外的安全令牌:https://github.com/yiisoft/yii2/issues/10532#issuecomment-169952232。
谢谢大家的帮助!
发布于 2016-01-08 05:20:40
试试这个:
'options'=>['data-abide'=>true]参考:在框架助手BaseHtml.php文件中,查找:
function renderTagAttributes其中:
foreach ($attributes as $name => $value) {if (is_bool($value)) { if ($value) { $html .= " $name"; } } elseif...
...
elseif ($value !== null) { $html .= " $name=\"" . static::encode($value) . '"'; }
...发布于 2016-01-08 18:03:22
对我来说,'data-abide'=>''和'data-abide'=>true都很好.
会不会过时了?你能尝试在你的项目中运行一个composer update吗?
https://stackoverflow.com/questions/34667635
复制相似问题