form submissions on a web page

nicedone
nicedone used Ask the Experts™
on
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

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2012
Top Expert 2008
Commented:
1) It is more secure to do server-side validations, since it is easier to bypass client-side scripting:

Client side validation and server side validation
 http://net-informations.com/faq/asp/validation.htm

2) There is nothing wrong, in my mind, with mixing server-side, and client-side validations.
RobOwner (Aidellio)
Most Valuable Expert 2015
Commented:
Just my 2c on what Bob has said.  Client side validations should be thought of more like helping guide the user through entering a form, not validating or sanitizing the data.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial