Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何指定自定义 web2py 表单的类?例如
{{=form.custom.begin}} Image name: <div>{{=form.custom.widget.name}}</div> Image file: <div>{{=form.custom.widget.file}}</div> Click here to upload: {{=form.custom.submit}} {{=form.custom.end}}
如何指定 CSS 类form?
form
如果是 SQLFORM,则可以在创建表单时指定类:
form = SQLFORM(db.mytable, _class='myclass')
否则,form.custom.begin只需生成以下 HTML:
form.custom.begin
<form action="" enctype="multipart/form-data" method="post">
form.custom.begin因此,您可以直接将该 HTML(添加了您的类)输入到模板中,而不是使用。