Several lines have several submit buttons, do I need to make a form for each button?

I list about 20 lines, each line represents an order.

Each line should have 3 buttons, each button will perform a different action.

I have 3 actions for processing each request to send each button, I just don’t know how to configure HTML forms for each button.

<tr>
<td>
<form method="post" action="/orders/do1"><input type=button ... /></form>
<form method="post" action="/orders/do2"><input type=button ... /></form>
<form method="post" action="/orders/do3"><input type=button ... /></form>
</td>
</tr>

Should I create 3 forms for each button, for each line in my listing?

(this will mean 20 lines x 3 forms = 60 forms per page)

This is normal? (i.e., or is there a better way to do this?)

+3
source share
8 answers

jQuery, , , .

, , .

, "", "" "", , ActionResult.

IMHO, .

+1

, , , - (, , URL- , id/index)

, . ( , , , jQueryUI, )

, ( ) , , .

( , -, ) ( , , , )

+1

ASP.NET MVC

! , MVC.

+1

. Asp.net HATES, . // - .

0

. . . - . , . , , " , ?"

html . -.

0

asp.net? , datalist, datagrid? OnItemCommand.

0

, javascript , , .

<input type=button onclick="do_action_one(row_i_value1, ....)" ... />
<input type=button onclick="do_action_two(row_i_value1, ....)"... />
<input type=button onclick="do_action_three(row_i_value1, ....)"... />
0

.

  • , , .

, .

  • JavaScript 2.
  • .
  • <button> , Internet Explorer ( 8 IIRC).

I am working on the fact that you want something like “Delete” and “Change” for each row and want to avoid “Delete row 1”, “Change row 1”, etc. If this is a false assumption, perhaps you can have one large form, use <input type="submit">and have consistent names and reasonable meanings.

0
source

Source: https://habr.com/ru/post/1730476/


All Articles