0

My View looks like this:

    @using (Html.BeginForm())
{
    <div>            <input type="image" src='../../Content/themes/base/images/Wizard/btn_Finish.gif' height="25" width="80" name="finishButton" value="finish;@Model.QuestionID" style="margin-right: 50px; margin-top: 20px;" align="right"/>
        }
        else
        {
            <input type="image" src='../../Content/themes/base/images/Wizard/btn_Next.gif' height="25" width="80" name="nextButton" value="next;@Model.QuestionID" style="margin-right: 50px; margin-top: 20px;" align="right"/>
        }
        @if (Model.QuestionID > 1)
        {
            <input type="image" src='../../Content/themes/base/images/Wizard/btn_Previous.gif' height="25" width="80" name="backButton" value="back;@Model.QuestionID" style="margin-right: 5px; margin-top: 20px;" align="right"/>
        }
    </div>
}

My Controller:

  public ActionResult QuestionaireWizard(string nextButton, string backButton, string finishButton, FormCollection form)

In Chrome, I get the correct values in the various buttons, but in IE they are always null. Just to note that if I look at the HTML source in runtime, the inputs have the correct values in them, but from some reason the controller never retrieve them.

Pacman
  • 2,183
  • 6
  • 39
  • 70
  • possible duplicate of [Input Type image submit form value?](http://stackoverflow.com/questions/7935456/input-type-image-submit-form-value) – xDaevax Jul 02 '14 at 18:13

1 Answers1

0

Internet explorer sends coordinates for image input types. These have the name followed by .x and .y. These are not valid c# variable names, unfortunately.

I'm not certain, but MVC may translate periods to underscores, so you may try changing name to name_x and name_y, and these will be the image coordinates that you clicked.

Erik Funkenbusch
  • 92,674
  • 28
  • 195
  • 291