Form/submit doesn't work in MobileView

1 posts, 1 answers
  1. Answer
    Steven
    Steven avatar
    29 posts
    Member since:
    Jul 2012

    Posted 25 Aug 2013 Link to this post

    Found my answer here

    I have declared the following in my Login.cshtml file.  Everything displays and accepts user input correctly.  However, the form submit button does nothing.  Is there a way to get it to work?

    @model LoginModel

    @{
        ViewBag.Title = "Login";
    }

    @(Html.Kendo().MobileView()
        .Name("view-login")
        .Title("Login")
        .Header(obj =>
            (Html.Kendo().MobileNavBar()
                    .Name("nav")
                    .Content(navbar =>
                        @<text>
                        @navbar.ViewTitle("")
                        </text>
                    )
                )
            )
        .Content(
            @<text>
            @LoginForm()
            </text>
        )
        )
    )

    @helper LoginForm()
        {
        <section id="loginForm">
        @using (Html.BeginForm())
        {
            @Html.AntiForgeryToken()
            @Html.ValidationSummary(true)

            <fieldset>
                <legend>Log in Form</legend>
                <ol>
                    <li>
                        @Html.LabelFor(m => m.UserName)
                        @Html.TextBoxFor(m => m.UserName)
                        @Html.ValidationMessageFor(m => m.UserName)
                    </li>
                    <li>
                        @Html.LabelFor(m => m.CompanyCode)
                        @Html.TextBoxFor(m => m.CompanyCode)
                        @Html.ValidationMessageFor(m => m.CompanyCode)
                    </li>
                    <li>
                        @Html.LabelFor(m => m.Password)
                        @Html.PasswordFor(m => m.Password)
                        @Html.ValidationMessageFor(m => m.Password)
                    </li>
                    <li>
                        @Html.CheckBoxFor(m => m.RememberMe)
                        @Html.LabelFor(m => m.RememberMe, new { @class = "checkbox" })
                    </li>
                </ol>
                <input type="submit" value="Log in" />
            </fieldset>
        }
        </section>
    }

    @(Html.Kendo().MobileApplication()
        .ServerNavigation(true)
    )

    ADDITIONAL NOTES:

    I determined that the cause of the malfunctioning Login button is the fact that the form produced by BeginForm is empty and reads as such:

    <form action="/Account/Login" method="post"></form>

    Any ideas why the form is coming up empty?
Back to Top