How to prevent form element from sending some fields we don't want?

后端 未结 3 1757
自闭症患者
自闭症患者 2020-11-30 10:35

I have a form element that contains about 5 fields which final query is going to create by processing values those fields. So I want to send only final query, not all of tho

3条回答
  •  渐次进展
    2020-11-30 11:18

    Remove the name attribute on the fields you do not want submitted to the server.

    This is the simplest way to achieve what you want, and it works on all major browsers.

    W3 spec talks about only submitting form values when name is present: http://www.w3.org/TR/html401/interact/forms.html#h-17.2

提交回复
热议问题