forked from stripe-archive/jquery.payment
-
Notifications
You must be signed in to change notification settings - Fork 105
Getting Started
Ellegonzalez edited this page Nov 19, 2016
·
2 revisions
To get you started with Formance, we've provided a little example below. This form contains one phone number field. The user will be unable to submit the form, until a valid phone number has been entered.
<!DOCTYPE html>
<html lang="en">
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="js/jquery.formance.min.js"></script>
<script>
$( function() {
$("input[type='submit']").prop("disabled", true); // disable the submit button
$("input.phone_number").formance("format_phone_number") // setup the formatter
.on( 'keyup change blur', function (event) { // setup the event listeners to validate the field whenever the user takes an action
if ( $(this).formance('validate_phone_number') )
$("input[type='submit']").prop("disabled", false); // enable the submit button if valid phone number
else
$("input[type='submit']").prop("disabled", true); // disable the submit button if invalid phone number
});
});
</script>
</head>
<body>
<form >
<label>Phone Number (US & Canada)</label>
<input type="text" class="phone_number">
<input type="submit">
</form>
</body>
</html>
Also Read: Credit Card Debt Consolidation