【发布时间】:2011-09-18 16:55:19
【问题描述】:
参考http://codeigniter.com/user_guide/helpers/form_helper.html 的 Codeigniter 用户指南,我似乎无法弄清楚如何使用 CI 的表单助手设置表单的“名称”属性。传入数组只能设置'id'。不传数组给form_open()函数可以设置表单的'name'吗?
【问题讨论】:
标签: php html forms codeigniter
参考http://codeigniter.com/user_guide/helpers/form_helper.html 的 Codeigniter 用户指南,我似乎无法弄清楚如何使用 CI 的表单助手设置表单的“名称”属性。传入数组只能设置'id'。不传数组给form_open()函数可以设置表单的'name'吗?
【问题讨论】:
标签: php html forms codeigniter
你可以用这个方法
$attributes = array('name' => 'myform');
echo form_open('email/send', $attributes);
【讨论】:
Can the 'name' of the form be set without passing an array to the form_open() 表示 OP 不想传递数组,句号。我认为这个问题具有误导性
表单的 name 属性实际上已被弃用:
17.3 表单元素
[....]
name = cdata [CI] This attribute names the element so that it may be referred to来自样式表或脚本。笔记。 此属性已包含在 向后兼容性。应用 应该使用 id 属性来 识别元素。
来源:W3.org
如果你真的想通过它,恐怕你别无选择,只能使用你想避免的数组,正如你在手册中阅读的那样。
【讨论】:
document.forms['myform']
document.getElementById('myformid')?你为什么反对?