Created
August 20, 2010 02:43
-
-
Save abraham/539481 to your computer and use it in GitHub Desktop.
Require phone numbers on Chargify hosted pages.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Past into the custom javascript field for your hosted page to use javascript to require phone numbers. | |
var phoneLabel = jQuery('[for=subscription_customer_attributes_phone]'); | |
phoneLabel.text('* Phone') | |
phoneInput = jQuery('#subscription_customer_attributes_phone'); | |
jQuery('#hosted-payment-form').submit(function(){ | |
if(phoneInput.val() == '') { | |
phoneLabel.text('* Phone: cannot be blank.') | |
phoneLabel.css('color', 'red'); | |
phoneInput.click(function(){ | |
jQuery('#subscription_submit').removeAttr('disabled'); | |
}); | |
return false; | |
} else { | |
return true; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment