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

jQueryJSPC#

Avatar of undefined
Last Comment
Rob

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Bob Learned

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Rob

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck