lateapex
asked on
jQuery Mobile button won't submit form
Experts,
MVC 4; jquery mobile
My save button won't submit the form. If I click in a text box and hit enter all is well. There is much chatter about this and I've tried some fixes like replacing the # with %23 but no luck
Here is the submit button and associated script
Here's the entire page
MVC 4; jquery mobile
My save button won't submit the form. If I click in a text box and hit enter all is well. There is much chatter about this and I've tried some fixes like replacing the # with %23 but no luck
Here is the submit button and associated script
@section scripts
{
<script type="text/javascript">
function submitForm() {
if (document.forms.length) {
document.forms[0].action = "/RaceData/Edit/@Model.raceNotesId"
document.forms[0].submit();
}
return true;
}
</script>
}
@section Header
{
<a href="/Home/" data-icon="back" data-rel="back">Cancel</a>
<a href="#" onclick="submitForm();" data-icon="check">Save</a>
<h3>@ViewBag.Title</h3>
}
Here's the entire page
@{
ViewBag.Title = "Edit Race Notes";
Layout = "~/Views/Shared/_Layout.cshtml";
}
@model KartNotes.Models.RaceNotes
@section scripts
{
<script type="text/javascript">
function submitForm() {
if (document.forms.length) {
document.forms[0].action = "/RaceData/Edit/@Model.raceNotesId"
document.forms[0].submit();
}
return true;
}
</script>
}
@section Header
{
<a href="/Home/" data-icon="back" data-rel="back">Cancel</a>
<a href="#" onclick="submitForm();" data-icon="check">Save</a>
<h3>@ViewBag.Title</h3>
}
<form method="post" >
<div data-role="fieldcontain">
<textarea id="raceNotes" name="raceNotes" placeholder="raceNotes" >@Model.raceNotes</textarea>
<!--<input type="text" style="height:100px;" name="raceNotes" id="raceNotes" value="@Model.raceNotes" placeholder="raceNotes" />-->
<label for="raceNotes">Notes</label>
<input type="text" name="raceDate" id="raceDate" value="@Model.raceDate" placeholder="raceDate" />
<label for="raceDate">Race Date</label>
</div>
</form>
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Please either provide a link to the page, or post the entire generated html.