You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NOTE: Design should follow existing modals until we implement #158
Original html:
<div class="modal hidden card" id="add-a-card">
<form class="form-horizontal" method="post" action="${ uri(account.cards_uri) }">
${ csrf_token() | n }
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3>add new card</h3>
</div>
<div class="modal-body">
% for index, field in enumerate(this.create_a_card.items):
<%forms:inline_row field="${ field }">
${ field.label }
<div class="controls">
% if index:
${ field(autocomplete='off') }
% else:
${ field(autofocus='autofocus') }
% endif
</div>
</%forms:inline_row>
% endfor
</div>
<div class="modal-footer">
<button class="btn btn-bal">create</button>
</div>
</form>
</div>
Original JavaScript
function validateAccountCreateForm(e) {
var $form = $(this);
var accountType = $('#type-account_type').val();
if (accountType.indexOf('buyer') === -1 || $('#cct-card_uri').val()) {
// we need to tokenize credit card before we submit the rest which
// means we need to validate the rest of the buyer's details first
return;
}
e.preventDefault();
$form.find('#buyer-information').find('.row').removeClass('error');
var cardData = {
name:$form.find('#cc-card_name').val(),
card_number:$form.find('#cc-card_number').val(),
expiration_month:$form.find('#cc-expiration_month').val(),
expiration_year:$form.find('#cc-expiration_year').val(),
security_code:$form.find('#cc-security_code').val(),
phone_number:$form.find('#cc-phone_number').val()
};
if (!cardData.phone_number) {
delete cardData.phone_number;
}
if (!cardData.name || cardData.name.length < 2) {
$form.find('#cc-card_name').closest('.row').addClass('error');
}
if (!balanced.card.isCardNumberValid(cardData.card_number)) {
$form.find('#cc-card_number').closest('.row').addClass('error');
}
if (!balanced.card.isExpirationValid(cardData.expiration_month, cardData.expiration_year)) {
$form.find('#cc-expiration_month').closest('.row').addClass('error');
}
if (!balanced.card.isSecurityCodeValid(cardData.card_number, cardData.security_code)) {
$form.find('#cc-security_code').closest('.row').addClass('error');
}
if ($form.find('#buyer-information').find('.error').length) {
// errors!
return;
}
formUtils.disable($form);
balanced.card.create(cardData, onAccountCardTokenized);
}
The text was updated successfully, but these errors were encountered:
NOTE: Design should follow existing modals until we implement #158
Original html:
Original JavaScript
The text was updated successfully, but these errors were encountered: