Skip to content

Commit 46218eb

Browse files
author
Dylan McCall
committed
Ugly hack to pass other field to donate form
:(
1 parent 48959c7 commit 46218eb

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

python_env/src/cc.engine/cc/engine/templates/includes/deed_donate_slide.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<div class="donate-box">
88
<div class="widget-inner">
99
<div class="gform_wrapper" id="gform_wrapper_10">
10-
<form method="post" enctype="multipart/form-data" id="gform_10" action="/donate">
10+
<form method="get" id="gform_10" action="/donate" class="deed-donate-form">
1111
<div id="field_10_1" class="gfield field_sublabel_below field_description_below">
1212
<label class="gfield_label">{% trans %}Contribute today to Creative Commons{% endtrans %}</label>
1313
<div class="ginput_container ginput_container_radio">

python_env/src/cc.engine/cc/engine/templates/macros_templates/deed.html

+24
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,30 @@ <h2>
199199
/* ]]> */
200200
</script>
201201
<script type='text/javascript' src='/wp-content/themes/twentysixteen/js/functions.js'></script>
202+
203+
<script type="text/javascript">
204+
//<![CDATA[
205+
var donateForms = $('.deed-donate-form');
206+
207+
$(donateForms).each(function() {
208+
var otherFields = $('input[value="gf_other_choice"]');
209+
210+
$(this).on('submit', function() {
211+
$(otherFields).each(function() {
212+
var parent = $(this).closest('li');
213+
var radioField = $(this);
214+
var txtField = $(parent).children('input[type="text"]');
215+
var txtValue = txtField.val();
216+
217+
if (txtValue || radioField.is(':checked')) {
218+
radioField.val(txtValue);
219+
}
220+
});
221+
});
222+
});
223+
//]]>
224+
</script>
225+
202226
<script type="text/javascript">
203227
//<![CDATA[
204228
$(document).ready(function() {

0 commit comments

Comments
 (0)