Last active
August 24, 2016 22:24
-
-
Save lscoates/9dd6ea7793321783b5ac34b672ea4dbe to your computer and use it in GitHub Desktop.
VAT Validation
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
var shipping_only = "You must first specify your Shipping Country" | |
var billing_only = "You must first specify your Billing Country" | |
var billing_or_shipping = "You must first specify your Billing or Shipping Country" | |
var shipping_or_billing = "You must first specify your Shipping or Billing Country" | |
$('#subscription_customer_attributes_country').change(function(e) { | |
var error_message = $("#long_vat_message").text(); | |
if ((e.target.value !== "") && ((error_message === shipping_only) || (error_message === billing_or_shipping) || (error_message === shipping_or_billing))) { | |
hideVatErrorMessage(); | |
} | |
}); | |
$('#subscription_payment_profile_attributes_billing_country').change(function(e) { | |
var error_message = $("#long_vat_message").text(); | |
if ((e.target.value !== "") && ((error_message === billing_only) || (error_message === billing_or_shipping) || (error_message === shipping_or_billing))) { | |
hideVatErrorMessage(); | |
} | |
}); | |
hideVatErrorMessage = function() { | |
$('#vat_button').prop('disabled', false); | |
$('#vat_button').removeClass('disabled'); | |
$("#long_vat_message").hide(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment