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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:39:52+00:00 2026-05-17T02:39:52+00:00

Hi I want to validate a form using a button, but this button call

  • 0

Hi I want to validate a form using a button, but this button call a .ajax function to submit the form.

How can i do this? I’ve searching.

I had one way but i wonder if there’s an easy way.

The way I accomplished this is:

Javascript

jQuery(document).ready(function () {
      $(ACCION).validate({
                rules: {
                    StartDate: {
                        required: true,
                        australianDate: true

                    },
                    EndDate: {
                        required: true,
                        australianDate: true

                    }

                }
            });

        });
 function Mostrar() {
        var textBox = $("#StartDate");
        var textBox2 = $("#EndDate");
        if (textBox.valid() == true & textBox2.valid() == true) {
            var fechaIn = document.getElementById('FechaInicio').value;
            var fechaFin = document.getElementById('FechaFin').value;                
            jQuery(NOMBRE_GRID).setGridParam({ postData: { fecha1: textBox.val(), fecha2: textBox2.val()} })
                            .trigger('reloadGrid');
        }
    }

HTML

<form id="myForm" method="post" action="">

            <div class="editor-label">
                <%= Html.Label("Fecha Inicio") %>
            </div>
            <div class="editor-field">
                <%=Html.TextBox("StarDate", DateTime.Now.ToString("yyyy-MM-dd"))%>
            </div>
            <div class="editor-label">
                <%= Html.Label("Fecha Final") %>
            </div>
            <div class="editor-field">
                <%=Html.TextBox("EndDate", DateTime.Now.AddDays(1).ToString("yyyy-MM-dd"))%>
            </div>           
            <input class="button button-big" name="Submit" type="button" value="Buscar Registros"
                onclick="Mostrar();" />
</form>

I wonder that instead of using valid() is there a way to validate the whole form.

Thanks!

  • 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-17T02:39:52+00:00Added an answer on May 17, 2026 at 2:39 am

    You can also call .valid() on the form itself to cause a complete validation:

    if($("#myForm").valid()) {
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im using asp.net webforms. c# I want to validate a form. In the codebehind
I have a jQuery function tied to my submit button like this: $(function ()
I'm using jQuery validation to validate a form with a radio button set on
I want to validate form when click client button out of form, i tryed
I am using Inline Form Validation Engine 1.6.2, jQuery plugin to validate form. But
I am using jQuery validate for validate an input. My code: $('#button').click( function() {
I have form where before i was using simple post with <button name=submit id=register
I want to use jQuery to submit my form and i can do that
I want to validate a form fields (text) input. It should only be a
Hi I want to validate a form input so it only takes the numbers

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.