1

I have a view with 2 submit buttons. Both must submit the form data to the controller, but the actions the perform are different.

If the user clicks Button A, the form is submitted, the model is modified, and the model is returned to the form with some updated information. I'd also like to make a visible if Button A was clicked. So, initially, the is not visible, but if button A has been clicked, when the view is re-displayed, the must be visible. (Possible?)

Then, if button B is clicked, the form is submitted, and the details are persisted to the database.

Is this possible? Can I do some JQuery actions (Make a table visible) and then submit to the controller, and when the view is re-drawn, the table will be visible?

1 Answer 1

2

There are two options

  1. Either use javascript to modify form action
  2. Use same action, than on the basis of button, move your logic into different functions.

Example for case 2:

<input type="submit" name="button" value="Save" />
<input type="submit" name="button" value="Delete" />

and in *action*,

if (formCollection["button"] == "Save")
{

}
else
{
}

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.