Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save code-nation/a1f87474d6913b80f22719ff5649f6c3 to your computer and use it in GitHub Desktop.
Save code-nation/a1f87474d6913b80f22719ff5649f6c3 to your computer and use it in GitHub Desktop.
Hack for Optional Phone Field on Donate Page
<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