Link to home
Start Free TrialLog in
Avatar of nicedone
nicedone

asked on

form submissions on a web page

Hi,

i do have a .net MVC application that has some front end work that is lacking,

In every page on my application i have submit button to do form posting or getting etc.

i dont think that is the right approach, i believe i should utilize jquery ,javascript etc.. in my application to make it faster and reduce the server side calls? For instance below is one of my forms, but this form is created by default when I used MVC scaffolding, should I use <form> tag itself rather than BeginForm? should i use submit button or should i use jquery ajax and fire a post in the event create button clicked?  could you help me on these improvements?

is posting a form through submit button ,or firing a post when button (not submit) is clicked , are these same things , what is the ajax call have to do with all these? Also i have validation on the page but these validations are server side, i should really do client side validations ,could you help me get started on these as a beginer to front-end ?should i use jquery validations and how to do these?




<h3>Update details of  "@Model.Name" </h3>

@using (Html.BeginForm()) {
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>Project</legend>

        @Html.HiddenFor(model => model.Id)
        <table>
            <tr>
                <td>
                    <div class="editor-label">
                        @Html.LabelFor(model => model.Date)
                    </div>
                </td>
                <td>
                    <div class="editor-field">
                        @Html.TextBox("Date", Model.Date.ToString("dd/MM/yyyy"), new { @class = "datefield" })
                        @*@Html.TextBox(model => model.Date, new { @class = "datefield" })*@
                        @*@Html.TextBox(model => model.Date, new { @class = "datefield" })*@
                        @Html.ValidationMessageFor(model => model.Date)

                        @*<input type="date" id="txtDate" class="datefield" value="@Model.Date.ToShortDateString()" />*@
                    </div>

                </td>
            </tr>
            <tr>
                <td>
                    <div class="editor-label">
                        @Html.LabelFor(model => model.Name)
                    </div>
                </td>
                <td>
                    <div class="editor-field">
                        @Html.EditorFor(model => model.Name)
                        @Html.ValidationMessageFor(model => model.Name)
                    </div>
                </td>
            </tr>
            <tr>
                <td>
                    <div class="editor-label">
                        @Html.LabelFor(model => model.Pmam)
                    </div>
                </td>
                <td>
                    <div class="editor-field">
                        @Html.EditorFor(model => model.Pmam)
                        @Html.ValidationMessageFor(model => model.Pmam)
                    </div>
                </td>
            </tr>
            <tr>
                <td>
                    <div class="editor-label">
                        @Html.LabelFor(model => model.Description)
                    </div>
                </td>
                <td>
                    <div class="editor-field">
                        @Html.EditorFor(model => model.Description)
                        @Html.ValidationMessageFor(model => model.Description)
                    </div>
                </td>
            </tr>

        </table>
        <p>
            <input type="submit" value="Save" /> |
            @Html.ActionLink("Back to List", "Index", "Home")
        </p>
    </fieldset>
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial