We help IT Professionals succeed at work.
Get Started

form submissions on a web page

nicedone
nicedone asked
on
223 Views
Last Modified: 2015-06-10
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
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2008
Commented:
This problem has been solved!
Unlock 2 Answers and 2 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE