Two submit buttons in one form

前端 未结 19 2052
不思量自难忘°
不思量自难忘° 2020-11-21 23:23

I have two submit buttons in a form. How do I determine which one was hit serverside?

19条回答
  •  灰色年华
    2020-11-22 00:02

    An even better solution consists of using button tags to submit the form:

    ...

    The HTML inside the button (e.g. ..>Update<.. is what is seen by the user; because there is HTML provided, the value is not user-visible; it is only sent to server. This way there is no inconvenience with internationalization and multiple display languages (in the former solution, the label of the button is also the value sent to the server).

提交回复
热议问题