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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:10:59+00:00 2026-05-26T16:10:59+00:00

I want to validate few inputs before submiting the form, i am doing this

  • 0

I want to validate few inputs before submiting the form, i am doing this

$(document).ready(function(){
    $('#form_arc_packages').submit(function(e){ /*should i use focus or similar, here?*/
        e.preventDefault();
        if(validarFormulario()==true){
            $('#form_arc_packages').submit(); /*Am i starting an infinite loop, here?*/
        }
    });
});

where

function validarFormulario(){       
        var valido = true;
        $('.errorCanc').slideUp();
        var fecha1=$('#date1').val();
        var fecha2=$('#date2').val();
        var area1=$('#area1').val();
        var area2=$('#area2').val();

        if (fecha1.length < 1){     $('#date1').next('.errorCanc').slideDown();     valido = false;     }
        if (fecha2.length < 1){  $('#date2').next('.errorCanc').slideDown();        valido = false;     }
        if (area1.length < 1){  $('#area1').next('.errorCanc').slideDown();     valido = false;     }   
        if (area2.length < 1){  $('#area2').next('.errorCanc').slideDown();     valido = false;     }   

        return valido;
}

Just checking the lenght of the inputs, for now, but the problem is that the form won’t be submited (even when all inputs are set and with console.log i am making sure that validarFormulario returns true),

EDIT

And like this:

$(document).ready(function(){
        $('#form_arc_packages').submit(function(e){ 
            if(validarFormulario()==true){
                $('#form_arc_packages').submit(); 
            }else{
                //Post didn't pass validation, so prevent posting
                e.preventDefault(); return false;
            }
        });
});

Seems to work ok in Firefox but for example, in IE7, it shows the errors (with the slideDown) and then stills submit the form… -EDIT- ignore this, it happened because of the console.log() i was using. works fine.

What am i doing wrong?

  • 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-26T16:11:00+00:00Added an answer on May 26, 2026 at 4:11 pm

    Change it to this…

    $(document).ready(function(){
        $('#form_arc_packages').submit(function(e){        
            if(validarFormulario()==false){
                e.preventDefault();
            }            
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to validate a condition before doing the next step, but only raise
I've thought of a few ways of doing this but I want to get
I want to validate a registration form that accepts an email address in the
On destruction of a restful resource, I want to guarantee a few things before
I'm trying to use jQuery validation plugin to validate a few form fields by
here i want to validate few textboxes by Element Finding on button Click event
i am using a form with several textbox elements which i want to validate
$(#myform).validate({ submitHandler: function (form) { var cboxes = ($('input:checkbox:checked').filter(:checked).length); var nboxes = ($(:checkbox:not(:checked)).length); var
I want to validate the value a user enters in a text box, so
I want to validate a set of credentials against the domain controller. e.g.: Username:

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.