Created
September 4, 2016 03:41
-
-
Save code-nation/a1f87474d6913b80f22719ff5649f6c3 to your computer and use it in GitHub Desktop.
Hack for Optional Phone Field on Donate Page
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
<div class="row"> | |
<div class="col-md-12"> | |
<div class="form-group"> | |
<label for="donation_billing_address_phone_number" class="control-label">Phone</label> | |
{% phone_field "billing_address.phone_number", class:"text form-control", placeholder:"Phone" %} | |
<small style="display: block; padding-top: 5px; line-height: 16px;"> | |
<a id="donate_no_phone" href="#">Click here</a> to make a donation without providing a phone number | |
</small> | |
<script type="text/javascript"> | |
$(function(){ | |
$('#donate_no_phone').click(function(e){ | |
e.preventDefault(); | |
var phoneField = $('#donation_billing_address_phone_number'); | |
$(this).closest('.row').hide(); | |
if(!phoneField.val()){ | |
phoneField.val('00000000'); | |
} | |
return false; | |
}); | |
}); | |
</script> | |
</div> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment