Skip to main content
added 3 characters in body; edited title
Source Link
Diego
  • 5.7k
  • 2
  • 28
  • 61

Posting a single form with multiple buttons in a Sitecore page. Is it possible?

Anyone know if it is possible to post a single form with multiple buttons and each button post to a different controller action in Sitecore? On my scenario I have a controller which has 3 actions:

1- load of the page

2- httppost from button A

3- httppost from button B

I'm using an using (Html.BeginForm()) to declare my form and I'm declaring the buttons like this:

<button type="Submit" id="btn" formaction="MyFormActionA"  formmethod="POST" class="btn btn-large">
<button type="Submit" id="btn" formaction="MyFormActionB"  formmethod="POST" class="btn btn-large">

The problem with this approach is that it posts to a different url and doesn't really work. I know that there are ways around that by setting the form action using javascript and things like that. What I'm wondering is whether it is possible to achieve that using this approach or a similar approach where one can post to different actions withing the same form. As far as I understand it is possible to do this with ASP.NET MVC but not sure on Sitecore.

Posting a single form with multiple buttons

Anyone know if it is possible to post a single form with multiple buttons and each button post to a different controller action in Sitecore? On my scenario I have a controller which has 3 actions:

1- load of the page

2- httppost from button A

3- httppost from button B

I'm using an using (Html.BeginForm()) to declare my form and I'm declaring the buttons like this:

<button type="Submit" id="btn" formaction="MyFormActionA"  formmethod="POST" class="btn btn-large">
<button type="Submit" id="btn" formaction="MyFormActionB"  formmethod="POST" class="btn btn-large">

The problem with this approach is that it posts to a different url and doesn't really work. I know that there are ways around that by setting the form action using javascript and things like that. What I'm wondering is whether it is possible to achieve that using this approach or a similar approach where one can post to different actions withing the same form. As far as I understand it is possible to do this with ASP.NET MVC but not sure on Sitecore

Posting a single form with multiple buttons in a Sitecore page. Is it possible?

Anyone know if it is possible to post a single form with multiple buttons and each button post to a different controller action in Sitecore? On my scenario I have a controller which has 3 actions:

1- load of the page

2- httppost from button A

3- httppost from button B

I'm using an using (Html.BeginForm()) to declare my form and I'm declaring the buttons like this:

<button type="Submit" id="btn" formaction="MyFormActionA"  formmethod="POST" class="btn btn-large">
<button type="Submit" id="btn" formaction="MyFormActionB"  formmethod="POST" class="btn btn-large">

The problem with this approach is that it posts to a different url and doesn't really work. I know that there are ways around that by setting the form action using javascript and things like that. What I'm wondering is whether it is possible to achieve that using this approach or a similar approach where one can post to different actions withing the same form. As far as I understand it is possible to do this with ASP.NET MVC but not sure on Sitecore.

added 102 characters in body
Source Link
Diego
  • 5.7k
  • 2
  • 28
  • 61

Anyone know if it is possible to post a single form with multiple buttons and each button post to a different controller action in Sitecore? On my scenario I have a controller which has 3 actions:

1- load of the page

2- httppost from button A

3- httppost from button B

I'm using an using (Html.BeginForm()) to declare my form and I'm declaring the buttons like this:

<button type="Submit" id="btn" formaction="MyFormActionA"  formmethod="POST" class="btn btn-large">
<button type="Submit" id="btn" formaction="MyFormActionB"  formmethod="POST" class="btn btn-large">

The problem with this approach is that it posts to a different url and doesn't really work. I know that there are ways around that by setting the form action using javascript and things like that. What I'm wondering is whether it is possible to achieve that using this approach or a similar approach where one can post to different actions withing the same form. As far as I understand it is possible to do this with ASP.NET MVC but not sure on Sitecore

Anyone know if it is possible to post a single form with multiple buttons and each button post to a different controller action? On my scenario I have a controller which has 3 actions:

1- load of the page

2- httppost from button A

3- httppost from button B

I'm using an using (Html.BeginForm()) to declare my form and I'm declaring the buttons like this:

<button type="Submit" id="btn" formaction="MyFormActionA"  formmethod="POST" class="btn btn-large">
<button type="Submit" id="btn" formaction="MyFormActionB"  formmethod="POST" class="btn btn-large">

The problem with this approach is that it posts to a different url and doesn't really work. I know that there are ways around that by setting the form action using javascript and things like that. What I'm wondering is whether it is possible to achieve that using this approach or a similar approach where one can post to different actions withing the same form.

Anyone know if it is possible to post a single form with multiple buttons and each button post to a different controller action in Sitecore? On my scenario I have a controller which has 3 actions:

1- load of the page

2- httppost from button A

3- httppost from button B

I'm using an using (Html.BeginForm()) to declare my form and I'm declaring the buttons like this:

<button type="Submit" id="btn" formaction="MyFormActionA"  formmethod="POST" class="btn btn-large">
<button type="Submit" id="btn" formaction="MyFormActionB"  formmethod="POST" class="btn btn-large">

The problem with this approach is that it posts to a different url and doesn't really work. I know that there are ways around that by setting the form action using javascript and things like that. What I'm wondering is whether it is possible to achieve that using this approach or a similar approach where one can post to different actions withing the same form. As far as I understand it is possible to do this with ASP.NET MVC but not sure on Sitecore

Source Link
Diego
  • 5.7k
  • 2
  • 28
  • 61

Posting a single form with multiple buttons

Anyone know if it is possible to post a single form with multiple buttons and each button post to a different controller action? On my scenario I have a controller which has 3 actions:

1- load of the page

2- httppost from button A

3- httppost from button B

I'm using an using (Html.BeginForm()) to declare my form and I'm declaring the buttons like this:

<button type="Submit" id="btn" formaction="MyFormActionA"  formmethod="POST" class="btn btn-large">
<button type="Submit" id="btn" formaction="MyFormActionB"  formmethod="POST" class="btn btn-large">

The problem with this approach is that it posts to a different url and doesn't really work. I know that there are ways around that by setting the form action using javascript and things like that. What I'm wondering is whether it is possible to achieve that using this approach or a similar approach where one can post to different actions withing the same form.