Sometimes this problem occurs: Multiple buttons are required on a form to complete different functions, such as a simple approval function.
If webform is used, it does not need to be discussed. However, a form in asp.net mvc can only be submitted to one Action for processing, which is relatively troublesome.
Use client scripts
<input type="submit" value="Approved" onclick='this.form.action="<%=Url.Action("Action1") %>";' />
<input type="submit" value="Review failed" onclick='this.form.action="<%=Url.Action("Action2") %>";' />
<input type="submit" value="Back" onclick='this.form.action="<%=Url.Action("Action3") %>";' />
OrDirectly include querystring
<Input type = "submit" value = "approved" onclick = 'this. form. action = "<% = Url. Action (" Action1 ") %>? Act = 1 "; '/>
<Input type = "submit" value = "REJECTED" onclick = 'this. form. action = "<% = Url. Action (" Action2 ") %>? Act = 2 "; '/>
<Input type = "submit" value = "return" onclick = 'this. form. action = "<% = Url. Action (" Action3 ") %>? Act = 3 "; '/>
When you click the submit button, first change the Form action attribute so that the Form is submitted to the corresponding action of the button for processing.
Sometimes this problem occurs: Multiple buttons are required on a form to complete different functions, such as a simple approval function.
If webform is used, it does not need to be discussed. However, a form in asp.net mvc can only be submitted to one Action for processing, which is relatively troublesome.
Use client scripts
<input type="submit" value="Approved" onclick='this.form.action="<%=Url.Action("Action1") %>";' />
<input type="submit" value="Review failed" onclick='this.form.action="<%=Url.Action("Action2") %>";' />
<input type="submit" value="Back" onclick='this.form.action="<%=Url.Action("Action3") %>";' />
OrDirectly include querystring
<Input type = "submit" value = "approved" onclick = 'this. form. action = "<% = Url. Action (" Action1 ") %>? Act = 1 "; '/>
<Input type = "submit" value = "REJECTED" onclick = 'this. form. action = "<% = Url. Action (" Action2 ") %>? Act = 2 "; '/>
<Input type = "submit" value = "return" onclick = 'this. form. action = "<% = Url. Action (" Action3 ") %>? Act = 3 "; '/>
When you click the submit button, first change the Form action attribute so that the Form is submitted to the corresponding action of the button for processing.