Template:Form-template/Form-template-default: Difference between revisions

Content deleted Content added
Pgehres (WMF) (talk | contribs)
oops
ugh, need to pass country down
 
(56 intermediate revisions by 2 users not shown)
Line 1:
{{MediaWiki:Resources/donate-form-infobox.css}}
<html>
<form method="GET" name="donateForm" aria-label="</html>{{int:donate_interface-donate-now}}<html>">
<script type="text/javascript">
 
<div id="donate-form-wrapper">
function getQuerystring( key ) {
<noscript><div class="error-nojs"></html>{{int:Donate_interface-noscript-msg}}<html></div><style>#actual-form-loading { display: none; }</style></noscript>
key = key.replace( /[\[]/, '\\\[' ).replace( /[\]]/, '\\\]' );
<div id="actual-form-loading">
var regex = new RegExp( '[\\?&]' + key + '=([a-zA-Z0-9\_\-]*)' );
Loading…<br>
var qs = regex.exec( window.location.search );
<small>(If the form does not load, your web browser may not be supported. Please try a different browser.)</small>
return qs == null ? '' : qs[1];
</div>
}
<div id="actual-form">
</html>{{CountryConfirm | country = {{{country}}} }}<html>
</html>{{Template:2012FR/Switch/Country
|template = 2012FR/{{{form-countryspecific}}}
|appeal = {{{appeal}}}
|language = {{int:lang}}
|country = {{{country}}}
}}<html>
</div>
</div>
 
</form>
//Should this be here?
var amount = null;
 
function DefaultSubmit(formfield,Action) {
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (Action) keycode = Action.which;
else return true;
 
if (keycode == 13) {
redirectPayment(</html>{{#ifeq:block|block|'1'|'2'}}<html>);
return false;
}
else
return true;
}
 
function validateForm(form){
 
var minimums = {</html>{{2012FR/Switch/Currency/Minimums}}<html>};
 
var error = true;
 
// Get amount selection
for ( var i = 0; i < form.amount.length; i++ ) {
if ( form.amount[i].checked ) {
amount = form.amount[i].value;
}
}
 
if ( form.input_amount_other_box.value != "" ) {
var otherAmount = form.input_amount_other_box.value;
otherAmount = otherAmount.replace(/[,.](\d)$/, '\:$10');
otherAmount = otherAmount.replace(/[,.](\d)(\d)$/, '\:$1$2');
otherAmount = otherAmount.replace(/[\$,.]/g, '');
otherAmount = otherAmount.replace(/:/, '.');
form.input_amount_other_box.value = otherAmount;
form.amountGiven.value = otherAmount;
amount = otherAmount;
}
 
// Check amount is a real number
error = ( amount == null || isNaN( amount ) || amount.value <= 0 );
// Check amount is at least the minimum
var currency = form.currency_code.value;
if ( typeof( minimums[currency] ) == 'undefined' ) {
minimums[currency] = 1;
}
if ( amount < minimums[currency] || error ) {
$( "#input_amount_other_box" ).val( '' );
$( "#input_amount_other" ).focus();
$( "#input_amount_other_box" ).focus();
alert( '</html>{{int:donate_interface-smallamount-error}}<html>'.replace('$1', (minimums[currency] + ' ' + currency) ) );
error = true;
}
if ( amount > 10000*minimums[currency]) {
$( "#input_amount_other_box" ).val( '' );
$( "#input_amount_other" ).focus();
$( "#input_amount_other_box" ).focus();
errorMessageLarge = '</html>{{int:Donate interface-bigamount-error}}<html>';
errorMessageLarge = errorMessageLarge.replace('$1',10000*minimums[currency]);
errorMessageLarge = errorMessageLarge.replace('$2',currency);
errorMessageLarge = errorMessageLarge.replace('$3','giving@wikimedia.org');
alert(errorMessageLarge);
error = true;
}
 
return !error;
}
 
</script>
<form method="post" name="paypalcontribution">
<input type="hidden" name="utm_source" value="" />
<input type="hidden" name="utm_medium" value="" />
<input type="hidden" name="utm_campaign" value="" />
<input type="hidden" name="referrer" value="" />
 
<script type="text/javascript">
document.paypalcontribution.utm_medium.value = getQuerystring( 'utm_medium' );
document.paypalcontribution.utm_campaign.value = getQuerystring( 'utm_campaign' );
document.paypalcontribution.referrer.value = document.referrer;
</script>
 
<input type="hidden" name="language" value="</html>{{int:lang}}<html>" />
<input type="hidden" name="country" value="</html>{{{country}}}<html>" />
<input type="hidden" name="returnto" value="Thank_You/</html>{{int:lang}}<html>" />
<input type="hidden" name="email-opt" id="input_email" value="1" checked="checked" />
 
<input type="hidden" name="amountGiven" value="" />
 
<div id="donate-form-wrapper">
</html>{{2012FR/Form-section/Paymentmethods/Status}}<html>
</html>{{Template:2012FR/Switch/Country
|template = 2012FR/{{{form-countryspecific}}}
|appeal = {{{appeal}}}
|language = {{int:lang}}
|country = {{{country}}}
}}<html>
<div class="dividing-line" id="form-line"></div>
<div id="donor-infobox-block">
</html>{{2012FR/Form-section/Infobox
| infobox = 2012FR/Form-section/Infobox/Default
| appeal = {{{appeal}}}
| width = 25em
| language = {{int:lang}}
| country = {{{country}}}
}}<html>
</div>
</div>
<div id="donor-policy-block">
</html>{{2012FR/Form-section/Privacy/Default
| language = {{int:lang}}
| country = {{{country}}}
}}<html>
</div>
<div class="donate" id="donate-links-block">
</html>{{2012FR/Form-section/Links/Default
| language = {{int:lang}}
| country = {{{country}}}
}}<html>
</div>
</form>
</html>