Template:2011FR/lp-form-US7amounts-gc: Difference between revisions

From Donate
Jump to navigation Jump to search
Content deleted Content added
Pgehres (WMF) (talk | contribs)
No edit summary
new code
Line 1: Line 1:
<html>
<html>
{{2012FR/Form-section/Processing/Default

| language = {{{language|en}}}
<script type="text/javascript" language="javascript">
| country = US
function validateForm( form ) {
| currency = USD

}}
var minimums = {
'USD' : 1,
'GBP' : 1, // $1.26
'EUR' : 1, // $1.26
'AUD' : 2, // $1.35
'CAD' : 1, // $0.84
'CHF' : 1, // $0.85
'CZK' : 20, // $1.03
'DKK' : 5, // $0.85
'HKD' : 10, // $1.29
'HUF' : 200, // $0.97
'JPY' : 100, // $1
'NZD' : 2, // $1.18
'NOK' : 10, // $1.44
'PLN' : 5, // $1.78
'SGD' : 2, // $1.35
'SEK' : 10, // $1.28
'ILS' : 5 // $1.39
};

var error = true;

// Get amount selection
var amount = null;
for ( var i = 0; i < form.amount.length; i++ ) {
if ( form.amount[i].checked ) {
amount = form.amount[i].value;
}
}
if ( form.amountGiven.value != "" ) {
var otherAmount = form.amountGiven.value;
otherAmount = otherAmount.replace(/[,.](\d)$/, '\:$10');
otherAmount = otherAmount.replace(/[,.](\d)(\d)$/, '\:$1$2');
otherAmount = otherAmount.replace(/[\$,.]/g, '');
otherAmount = otherAmount.replace(/:/, '.');
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 ) {
alert( '</html>{{{validation-error-minimum|You must contribute at least $1}}}<html>'.replace('$1', minimums[currency] + ' ' + currency ) );
$( "input[name='amountGiven']" ).val( '' );
$( "input[name='amountGiven']" ).focus();
error = true;
}
return !error;
}

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:{{CC-status}}|block|'1'|'2'}}<html>);
return false;
}
else
return true;
}

function redirectPayment(i) {
//if i == 1
var paymentType ="cc";
var action_url = "https://payments.wikimedia.org/index.php/Special:GlobalCollectGateway?uselang=</html>{{{language}}}\x26form_name={{{form-name}}}\x26appeal=JimmyQuote\x26ffname={{{ffname}}}<html>" ;
if (i==2) {
action_url="https://wikimediafoundation.org/wiki/Special:ContributionTracking/</html>{{{language|{{BASEPAGENAME}}}}}<html>";
paymentType = "pp";
}
document.paypalcontribution.action = action_url;
document.paypalcontribution.utm_source.value = getQuerystring( 'utm_source' ) + '.' + getLandingPage() + '.' + paymentType;
if (validateForm(document.paypalcontribution)) {
if(typeof(OWA) !== 'undefined'){OWATracker.shareStateByPost( document.paypalcontribution );}
document.paypalcontribution.submit();
}
}
</script>
<form method="post" name="paypalcontribution">
<input type="hidden" name="gateway" value="paypal" />
<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="language" value="</html>{{{language|{{SUBPAGENAME}}}}}<html>" />
<input type="hidden" name="referrer" value="" />
<input type="hidden" name="country" value="US" />
<input type="hidden" name="returnto" value="Thank_You/</html>{{{language|{{SUBPAGENAME}}}}}<html>" />

<div style="padding: 0.2em 0em; font-weight: normal;">
<div style="padding: 0.2em 0em; font-weight: normal;">
<p style="font-weight: bold;"></html>{{{gift-amount-text}}}<html></p>
<p style="font-weight: bold;"></html>{{{gift-amount-text}}}<html></p>

Revision as of 19:35, 24 October 2013

{{2012FR/Form-section/Processing/Default | language = {{{language|en}}} | country = US | currency = USD }}

{{{gift-amount-text}}}

*  *  *