Tagged: form
-
AuthorPosts
-
March 16, 2017 at 1:18 pm #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 withjQuery(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
TobiaMarch 16, 2017 at 1:39 pm #761895I 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.
March 16, 2017 at 1:59 pm #761905Hey!
Glad you figured it out and thanks for sharing your solution!
Let us know if you have any other questions or issuesCheers!
YigitMarch 16, 2017 at 2:48 pm #761941Ok, 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
TobiaMarch 16, 2017 at 2:57 pm #761948Hey!
Please refer to this post – http://kriesi.at/documentation/enfold/add-onclick-event-to-the-contact-form-submit-button/
Best regards,
YigitMarch 16, 2017 at 3:19 pm #761970Ok 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;
}March 16, 2017 at 3:25 pm #761978Hey!
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,
YigitDecember 5, 2017 at 10:51 pm #885239What if someone presses enter in the form without submiting with the button?
December 6, 2017 at 11:27 am #885496Hi NiklasRaab,
Are you able to submit the form without anything filled in after implementing the code in this thread?
Best regards,
RikardDecember 6, 2017 at 1:38 pm #885585Found an alternative Solution. I am waiting until the form turns invisible. Then i fire a callback were i execute the Tracking Pixel
December 6, 2017 at 4:07 pm #885624 -
AuthorPosts
- The topic ‘Add custom jquery code in submit form’ is closed to new replies.