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 6152581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:56:40+00:00 2026-05-23T19:56:40+00:00

Im using mvc 2, my view is as follows <% using (Html.BeginForm(ApplyLeave, ESS, FormMethod.Post,

  • 0

Im using mvc 2, my view is as follows

<% using (Html.BeginForm("ApplyLeave", "ESS", FormMethod.Post, new { id = "formApplyLeave" }))
       { %>
    <fieldset>            
        <div>
            <div>
                <label for="FromDate">
                    From</label></div>
            <div>
                <%=Html.TextBoxFor(l => l.FromDate, new { id = "FromDate", name = "FromDate", maxlength = 10 })%>
            </div>
            <div>
                <%=Html.ValidationMessageFor(l => l.FromDate)%></div>
        </div>
        <div>
            <div>
                <label for="ToDate">
                    To</label></div>
            <div>
                <%=Html.TextBoxFor(l => l.ToDate, new { id = "ToDate", name = "ToDate", maxlength = 10 })%>
            </div>
            <div>
                <%=Html.ValidationMessageFor(l => l.ToDate)%></div>
        </div>            
    </fieldset>
    <% } %>

and for submitting the form, im using jquery as

       $('#formApplyLeave').submit();

I wrote the validation in attributes in model.

Here im able to submit the form, but validation are not getting fired. How do i fire the validations in jquery, before submitting the form.

please help.

  • 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-23T19:56:41+00:00Added an answer on May 23, 2026 at 7:56 pm

    You could use the beforeSubmit callback to set values:

    Or using jQuery validation plug-in’s validate method

    try like this~

    $(document).ready(function() {
        $("#form1").submit(function() {
            $("#txt1").val("123");
    
            $("#form1").validate({
                rules: {
                        txt1: {
                                maxlength: 3
                        }
                }
            });
        });
    });
    

    This way validation will be triggered by your submit event handler.

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

Sidebar

Related Questions

Using asp.net MVC I'd like to do this inside a view: <%= Html.TextBox(textbox1, null,
Given an ASP.NET MVC view that generates a table of entries using a for
I have an application, built using MVC, that produces a view which delivers summary
Consider a normal customer-orders application based on MVC pattern using WinForms. The view part
I'm using MVC to validate some html text boxes on a page, for example
I have an MVC view with a form built with the Ajax.BeginForm() helper method,
I am using ASP.NET MVC 2, and am using a view-model per view approach.
I'm pretty new to MVC 2 using the Entity Framework. I have two tables
I am using a web application framework (Symfony 1.3.6), which follows the MVC pattern.
I have a Spring MVC/3.0 app using tiles as it's view, this is working

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.