formvalidation.io validate form on class click

I am using this form validation script: http://formvalidation.io/settings/

Can you please help me find how I change my code to submit the form on click of element with the class name of "csaf-stage1".

$(document).ready(function() {
		
	$('#csaf-form').formValidation({
		
		// live: 'enabled', // Default value
		trigger: 'input change keyup',
		fields: {
			default_deposit_amount: {
                validators: {
                    greaterThan: {
                        value: getDepositAmount,
                        message: 'The higher deposit must be 5% or greater'
                    }
                }
            }
        }
				
	}).on('success.form.fv', function(e) {
		
	// success code here
		
    });
				
});

Open in new window

petewinterAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Leonidas DosasCommented:
Try the following code comments inside:
$(document).ready(function() {
		
	$('#csaf-form').formValidation({
		
		// live: 'enabled', // Default value
		trigger: 'input change keyup',
		fields: {
			default_deposit_amount: {
                validators: {
                    greaterThan: {
                        value: getDepositAmount,
                        message: 'The higher deposit must be 5% or greater'
                    }
                }
            }
        }
	//As documentation said I use on event with selector the class='.csaf-stage1' to reigger the submit			
	}).on('click', '.csaf-stage1', function(e){
      //I set a var $form 
      var $form = $('.class_of_the_form'),
                fv    = $form.data('formValidation');
	//The ajax function triggers via click event	
	       $.ajax({
                url: $form.attr('action'),
                type: 'POST',
                data: $form.serialize(),
                success: function(result) {
                   console(result);
                }
            });
		
    });
				
});

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
petewinterAuthor Commented:
Thanks, but my form is not validating so I must have done something wrong if you can please check:

http://dev.cmyuk.com/csaf/

JQuery: http://dev.cmyuk.com/csaf/js/csaf.js

I basically want the form to submit when the "Next Step" text or if the "PURCHASE WITH FINANCE - CSAF" bar is clicked. So multiple trigger. Also you will notice the fields have live validation if you type in the loan value field.

Any idea what I am doing wrong?
0
petewinterAuthor Commented:
Thanks, but all I need to do was to add the below to my original code.

$( ".csaf-stage1" ).click(function() {
             $("#csaf-form").submit();
      });
0
Leonidas DosasCommented:
I hope that someway I find a solution to your problem. I search a lot your code but my code based at this link.
Thanks a lot.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
jQuery

From novice to tech pro — start learning today.