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

  • SEARCH
  • Home
  • 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 6752775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:05:03+00:00 2026-05-26T13:05:03+00:00

I tried to make an contact form via AJAX with jQuery and Validation Engine

  • 0

I tried to make an contact form via AJAX with jQuery and Validation Engine Plug in http://www.position-absolute.com/articles/jquery-form-validator-because-form-validation-is-a-mess/

The validation worked and before to send function worked too… but

The problem is that it cannot send form and it couldn’t callback from OnAjaxFormComplete that it will “hide” the form using jQuery. It’s used for development.

Go to http://bksn.mx/TAC/2/ click “Contacto” big title, it appears a contact form, try it.

My HTML of form:

    <form id="formID" method="post" action="submit.php">
<div class="ajax">
        <div class="idealWrap">
            <label for="nombre">nombre:</label>
            <input value="" class="validate[required] text-input" type="text" name="nombre" id="nombre"/>
        </div>

        <div class="idealWrap">
            <label for="email">email:</label>
            <input value="" class="validate[required,custom[email]]" type="text" name="email" id="email"/>
        </div>

        <div class="idealWrap">
            <label for="tel">teléfono:</label>
            <input value="" class="validate[custom[phone]] text-input" type="text" name="tel" id="tel" />
        </div>



        <div class="idealWrap">
            <label for="mensaje">mensaje:</label>
            <textarea value="" class="validate[required] text-input" name="message" id="message" ></textarea>
        </div>      

        <div class="idealWrap">
            <label>&nbsp;</label>
            <input type="submit" id="submit" value=""/>
        </div>
</div>
    </form>

There is my script:

function beforeCall(form, options) {
    if (window.console)
        alert("Right before the AJAX form validation call");
    return true;
}

// Called once the server replies to the ajax form validation request

function ajaxValidationCallback(status, form, json, options) {
    if (window.console)
        console.log(status);

    if (status === true) {
        $('#formID').hide();
        // uncomment these lines to submit the form to form.action
        // form.validationEngine('detach');
        // form.submit();
        // or you may use AJAX again to submit the data
    }
}

jQuery(document).ready(function () {
    jQuery("#formID").validationEngine({
        promptPosition: 'centerRight',
        scroll: false,
        ajaxFormValidation: true,
        onBeforeAjaxFormValidation: beforeCall,
        onAjaxFormComplete: ajaxValidationCallback,
    });
});

and my PHP script:

<?php
$aviso = "";
if ($_POST['email'] != "") {
    // email de destino
    $email = "vagnok@gmail";

    // asunto del email
    $subject = "Contacto";

    // Cuerpo del mensaje
    $mensaje = "---------------------------------- \n";
    $mensaje.= "            Contacto               \n";
    $mensaje.= "---------------------------------- \n";
    $mensaje.= "NOMBRE:   ".$_POST['nombre']."\n";
    $mensaje.= "EMAIL:    ".$_POST['email']."\n";
    $mensaje.= "TELEFONO: ".$_POST['tel']."\n";
    $mensaje.= "FECHA:    ".date("d/m/Y")."\n";
    $mensaje.= "HORA:     ".date("h:i:s a")."\n";
    $mensaje.= "IP:       ".$_SERVER['REMOTE_ADDR']."\n\n";
    $mensaje.= "---------------------------------- \n\n";
    $mensaje.= $_POST['mensaje']."\n\n";
    $mensaje.= "---------------------------------- \n";
    $mensaje.= "Enviado desde TAC  \n";

    // headers del email
    $headers = "From: ".$_POST['email']."\r\n";

    // Enviamos el mensaje
    if (mail($email, $subject, $mensaje, $headers)) {
        $aviso = "Su mensaje fue enviado.";
    } else {
        $aviso = "Error de envío.";
    }
}
 ?>

Anyone can help me?

Thanks in advance!

  • 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-26T13:05:04+00:00Added an answer on May 26, 2026 at 1:05 pm

    Have you read and tried the FAQ on github: https://github.com/posabsolute/jQuery-Validation-Engine ? There is a part where it says:

    When using options, the default behavior is to only initialize
    ValidationEngine, so attachment needs to be done manually.

    <script>
    $(document).ready(function(){
    $("#formID").validationEngine('attach', {promptPosition : "centerRight", scroll: false});
    });
    </script>
    

    In the code posted above you aren’t supplying any action as parameter. If you use any options for validationEngine you have to use “attach” as first parameter to enable the plugin to work!

    Your code should look like this:

    jQuery(document).ready(function () {
        jQuery("#formID").validationEngine('attach', {
            promptPosition: 'centerRight',
            scroll: false,
            ajaxFormValidation: true,
            onBeforeAjaxFormValidation: beforeCall,
            onAjaxFormComplete: ajaxValidationCallback,
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried to make a simple contact form via HTML and PHP but the
I'm using a great jQuery contact form validator from bassistance (http://bassistance.de/jquery-plugins/jquery-plugin-validation/) is exactly what
Tried to make a little old school ajax (iframe-javascript) script. A bit of mootools
I have tried to make a webservice interface to a state-holding COM component. The
I'm using jquery validation on a form with a text area. The html in
I tried this: http://channel9.msdn.com/posts/RobBagby/deCast-Entity-Framework-Modeling-Implementing-Entity-Splitting/Default.aspx?wa=wsignin1.0 ...with the Northwind sample database from Codeplex, using the Employee
I tried to make the title as clear as possible... here is my scenario:
I tried to make an independent copy of an array but couldnt get one.
I tried to make a custom pushpin for the Bing Maps silverlight control, but
I tried to make ValidationAttribute which would check the database whether such an object.

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.