Skip to content

Instantly share code, notes, and snippets.

@abraham
Created August 20, 2010 02:43
Show Gist options
  • Save abraham/539481 to your computer and use it in GitHub Desktop.
Save abraham/539481 to your computer and use it in GitHub Desktop.
Require phone numbers on Chargify hosted pages.
// 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