简体   繁体   English

为什么使用web2py自定义表单,即使没有{{= form.custom.submit}}也可以提交?

[英]why is web2py custom form, submitting even without {{=form.custom.submit}}?

I don't know what is happening, but my form is submitting even without the {{=form.custom.submit}} code. 我不知道发生了什么,但是即使没有{{=form.custom.submit}}代码,我的表单{{=form.custom.submit}}提交。


        {{=form.custom.begin}}
            <div>{{=form.custom.widget.id}}</div>
            <div>{{=form.custom.widget.details}}</div>

            <div id="submit"><button></button></div>
        {{=form.custom.end}}

Take note that only <div id="sc"><button></button></div> is what I put. 请注意,我只输入了<div id="sc"><button></button></div>

What is happening, please tell me how to fix this. 发生了什么事,请告诉我如何解决。

The default type for button elements is "submit", so your button tag acts as a submit button. 按钮元素的默认类型为“提交”,因此您的按钮标签用作提交按钮。 If you don't want it to act as a submit button, than explicitly set its "type" attribute to something other than "submit", such as "button" or "reset". 如果您不希望它充当“提交”按钮,则可以将其“类型”属性显式设置为除“提交”之外的其他内容,例如“按钮”或“重置”。

<button type="button"></button>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM