0
votes

I have an app that I am adding mobile pages using jQuery mobile for MVC 3. So far it is working great, until I got to the point I needed a submit button to hit the post in the controller.

I am just using a simple input button:

<div>
<div class="editor-label">
  @Html.LabelFor(m => m.UserName)
</div>
<div class="editor-field">
  @Html.NoAutoCompleteTextBoxFor(m => m.UserName)<br/>
  @Html.ValidationMessageFor(m => m.UserName)
</div>
<div class="editor-label">
  @Html.LabelFor(m => m.Password)
</div>
<div class="editor-field">
 @Html.PasswordFor(m => m.Password, new { AutoCompleteType = "None", autocomplete = "off" })<br/>
 @Html.ValidationMessageFor(m => m.Password)
</div>
  <p>
   @Html.ActionLink("Recover username/password", "LocateLoginInfo")
</p>
<div>

        <input type="submit" value="Log On" id="mobile_LogOn"/>

</div>

I am new to jQuery mobile, any help would be appreciated.

Thanks!

1
What doesn't work? The button isn't submitting or the button isn't being styled as a jQuery Mobile button? - Jack
I am expecting it to hit the [HttpPost] ActionResult LogOn in the controller. It isn't. It doesn't do anything. It is the same code for a button that I used in the non-mobile version page. - Loganj99

1 Answers

2
votes

Have you added the content in a form?

@using (Html.BeginForm("Login", "Account", FormMethod.Post))
{
  ...
  <input type="submit" value="Log On" id="mobile_LogOn"/>
}

It should work.