Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4053720
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:28:59+00:00 2026-05-20T14:28:59+00:00

Does ajax post supports the usual validation upon submit of a form? Is @using(Html.BeginForm()){

  • 0

Does ajax post supports the usual validation upon submit of a form?

Is

@using(Html.BeginForm()){
@Hml.ValidationSummary()

<input type="submit" value ="Save">
}

same as

    @using(Html.BeginForm(new {id=FormTest})){
     @Hml.ValidationSummary()
<input type="button" value= Save>
    }

<script type="javascript">
$("#Save").click(function(){
$("#FormTest").submit();

});
</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T14:29:00+00:00Added an answer on May 20, 2026 at 2:29 pm

    There are so many wrong things going on here that I really don’t know where to start.

    1. Your Html.BeginForm definition is wrong: you are confusing routeValues with htmlAttributes. See below for solution

    2. Your button doesn’t have an id so your javascript selector will most probably fail

    3. All those efforts are not necessary because a simple <input type="submit"> button does it out of the box.

    Now lets suppose that somehow you are a fan of javascript and you want to write it (I don’t know why would you want to write code but anyway). So start by fixing your form definition:

    @using(Html.BeginForm("someAction", "someController", FormMethod.Post, new { id = "FormTest" }))    
    {
        @Html.ValidationSummary()
        @Html.TextBoxFor(x => x.Foo)
    
        <input type="button" value="Save" id="Save" />
    }
    

    and then you could do this:

    $('#Save').click(function() {
        var form = $('#FormTest');
        if (form.valid()) {
            form.submit();
        }
    });
    

    obviously you must ensure that the client scripts are properly included on your page:

    <script src="@Url.Content("~/Scripts/jquery.validate.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.js")" type="text/javascript"></script>
    

    and of course the real solution I would recommend you is to use a submit button for submitting forms:

    @using(Html.BeginForm("someAction", "someController", FormMethod.Post, new { id = "FormTest" }))    
    {
        @Html.ValidationSummary()
        @Html.TextBoxFor(x => x.Foo)
    
        <input type="submit" value="Save" id="Save" />
    }
    

    Now you don’t need any javascript (obviously you still need the two script inclusions for the unobtrusive validation).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am attempting to pull some information from my tnsnames file using regex. I
I am trying to understand the practical difference during the execution of a program
I want the messagebox to only show if the number is equal to 0.
I'm trying to write test harness for part of my Android mapping application. I
Let say I have the following desire, to simplify the IConvertible's to allow me
After having read Ian Boyd 's constructor series questions ( 1 , 2 ,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.