Multiple rows have multiple submit buttons, should I make a form for each button?

Error processing SSI file

Answers

  1. Rylan

    • 2015/12/8

    From the snippet you've posted, I'm going to presume that you don't care about actually submitting any form data to your action - just invoking the correct action (with maybe some data that can be specified directly in the action url, like an id/index)

    If that is the case, then you don't even need a submit button for this. Just a plain link (which you can style to look like a button, either yourself or using jQueryUI, thus keeping things simple and pretty)

    If you do need to submit form data to your action, just give your submit buttons the same name and different values and check (or have your model binder work out) exactly which one invoked the action and let your controller act accordingly.

    See here (the second answer, hehe, the accepted one actually uses multiple forms) and here (this one is actually using some funky stuff that might be a bit of an overkill, and not entirely appropriate when generating an unknown number of submit buttons, but insteresting nonetheless)

  2. Kylen

    • 2016/6/3

    Should I create 3 forms for each button, per row in my listing? (that would mean 20 rows x 3 forms = 60 forms on a page). Is that 'ok' to do 

  3. Ahmed

    • 2015/12/14

    I am listing about 20 rows, each row represents an Order. Each row needs to have 3 buttons, each button click will perform a different action. I have 3 actions to handle each button post request, I am just unsure how to setup the Html forms for each button.

  4. Thiago

    • 2018/7/27

    , multiple submit buttons can include in the html form. One simple example is given below.

  5. Dubois

    • 2020/10/13

    Is this not an asp.net question? Could you not use a repeater, datalist, datagrid? Then you could handle each button click with the controls OnItemCommand.

  6. Keanu

    • 2016/1/31

    I have a form containing around 7 fields which is working correctly when I submit the form after filling in the data. There is an additional requirement to Add multiple Records simultaneaously by clicking on Add Rows button. Example - Currently user can fill one record information at a time but now

  7. Stanley

    • 2019/12/31

    How do you use two submit buttons in one form flask?

  8. Ivan

    • 2018/12/24

    I have some difficulty in setting up my form. I wanted to have two different submit button in two different or three different pages. Would it be possible ? Should I disable one by one the "require completing question" of each form ? Then, in thank you page and email auto reply settings can I customize on by one per submit pages I create ?

  9. Moore

    • 2017/9/22

    No. Asp.net HATES seeing multiple forms. Just give the buttons a different ID/name/value or something.

  10. Donovan

    • 2015/5/20

    This solution involves creating several input elements with the type being set to Also each button has to have a different text value.

  11. Mordechai

    • 2015/6/24

    Yes, you can have multiple submit buttons on a single form, however if you have a hidden field within the form, each submit button is going to submit that field. If each button needs to pass a certain variable, you can assign the value of the variable to the button instead of a hidden field, that way each button will submit a different value.

  12. Adrien

    • 2016/8/31

    how to have multiple form action buttons next to each other html php form multiple submit buttons · how i make two button into form one for get and 

  13. Kian

    • 2018/2/5

    No.. No.. No. Multiple forms are a bad bad idea. Yes, you can do this. And Yes you will experience weird behavior such as "what happens when the user pushes enter?"

    Each of the browsers handle seeing multiple forms in the same html document slightly differently. Save yourself the trouble and handle this differently.

  14. Hill

    • 2019/6/17

    How to submit multiple table rows inside a form I know this is not going to work. But this is what I am trying to do. I want multiple table rows data to be submitted to the form action not all at a once, but when clicking on the individual rows.

  15. Dennis

    • 2018/12/14

    Html answers related to “one form with two submit buttons” php form multiple submit buttons · how i make two button into form one for get and submit 

  16. Hezekiah

    • 2018/9/3

    yes, multiple submit buttons can include in the html form. One simple example is given below. Here I am using MVC VB.net.In view I am using three buttons with the same name but in different values. In the controller, I am using same name parameter (cmd) which is string type and compare with the value of button's value (Save, Update, Delete).

  17. Ward

    • 2015/9/21

    I'd use a jQuery postback rather than a form but that depends on what you are doing in your controller.

    It'd be handy if you could expand on the question to include that detail.

    For example, if the buttons are Create, Delete and Update then use a single form, going to a different ActionResult.

    It's row should be a partial view IMHO and you should have a single form.

  18. David

    • 2016/4/17

    To process a form with multiple buttons, your server-side code will need to know which button was pressed. To do so you can give each submit button a different 

  19. Remy

    • 2017/7/27

    If the user clicks on any button, then it will hit the same post method that we added in our form action post. However, as per our need, we need 

  20. Justice

    • 2015/5/5

    NET MVC to easily create HTML pages with multiple submit buttons, to get an HTML form to respond differently to different button pushes.

  21. Jason

    • 2018/12/11

    Authors create buttons with the BUTTON element or the INPUT element. input control and the TEXTAREA element creates a multi-line input control.

Comments are closed.

More Posts