Tagged: 

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #761870

    Hi,
    I would add custom jquery code during the check of the Enfold form fields but I can not intercept the submit event.
    I tried with

     jQuery(window).load(function(){
           jQuery(".avia_ajax_form").submit(function(event) {
              event.preventDefault();
              console.log("ok");   
            }); 
    });

    It does not work.
    Where can i find the function that adds red border to fields during the check validation? class-form-generator.php?

    thanks
    best regards
    Tobia

    #761895

    I solved it with this:

    jQuery('.avia_ajax_form input[type="submit"]').on('click', function(event) {

    ciao
    Tobia

    • This reply was modified 7 years, 9 months ago by digitos.
    #761905

    Hey!

    Glad you figured it out and thanks for sharing your solution!
    Let us know if you have any other questions or issues

    Cheers!
    Yigit

    #761941

    Ok, but if I did want to intercept the original validation function in Enfold, where can i find it?
    I saw in class-form-generator-php file that there is the function “check_element” but i don’t know if this check is made during the creation of the form or during the submit.
    I need to insert some custom jquery code to add the existing code of Enfold before submit form.
    How can I do?
    thanks
    Tobia

    #761948
    #761970

    Ok thanks but how to use this function?

    is correct so?

    `add_filter(‘avf_contact_form_submit_button_attr’,’avia_add_submit_attributes_to_cf’, 10, 3);
    function avia_add_submit_attributes_to_cf($att, $formID, $form_params){
    $attr=’jQuery(“.avia_ajax_form p”).each(function(){
    if ( jQuery( this ).hasClass( “error” ) ) {
    errore=true;
    }’;

    return $att;
    }

    #761978

    Hey!

    You should replace the following part of the code

    
    _gaq.push(['_trackPageview', '/VP/XXX/XXX']);

    with what you would like to do onclick basically :)

    Best regards,
    Yigit

    #885239

    What if someone presses enter in the form without submiting with the button?

    #885496

    Hi NiklasRaab,

    Are you able to submit the form without anything filled in after implementing the code in this thread?

    Best regards,
    Rikard

    #885585

    Found an alternative Solution. I am waiting until the form turns invisible. Then i fire a callback were i execute the Tracking Pixel

    #885624

    Hi,

    Glad you figured it out and thanks for sharing your solution! If you have any other questions or issues, please start a new thread under Enfold sub forum :)

    Best regards,
    Yigit

Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘Add custom jquery code in submit form’ is closed to new replies.