Template:2011FR/lp-form-US7amounts-extrainfo-noppval3

 input:-webkit-autofill { color: #fff !important; } { padding: 0.2em 0em; font-weight: normal; }
 * 1) donation-form

{ font-weight: bold; padding-bottom: 1em; }
 * 1) donation-form-title

{ font-size: 100%; padding: 0; }
 * 1) amount-box

{ margin-left: 3px; }
 * 1) amount-table tr td label

{ font-style: italic; font-weight: bold; }
 * 1) amount_table_header

.div_amount_radio { white-space: nowrap; float: left; width: 4em; padding-right: 1px; }

.amount-label { width: 3em; }

select#input_currency_code { font-size:70%; width:8em; vertical-align: middle; }

{ border-color: #C0C0C0; border-style: solid; border-width: 1px; color: #999999; width: 3em; font-size: 0.9em; height: 0.9em; vertical-align: middle; }
 * 1) input_amount_other_box

div#card-info-block { font-size: 0.9em; display:table; margin: 0.5em 0; }

.card-info-row { display:table-row; margin: 0.5em 0; }

.card-input { border-color: #C0C0C0; border-style: solid; border-width: 1px; color: #999999; font-size: 0.9em; }

.card-input-title { font-size: 1em; padding-bottom: 3px; padding-right: 3px; display:table-cell; width: 60px; }

.card-input-block { padding-bottom: 3px; display:table-cell; }

{ width: 112px; }
 * 1) card_name_first

{ width: 112px; margin-left: 1px; }
 * 1) card_name_last

{ width: 233px; }
 * 1) card_address_street_1

{ width: 124px; }
 * 1) card_address_city

{ width: 52px; vertical-align: middle; font-size: 90%; }
 * 1) card_address_state

{ width: 45px; }
 * 1) card_address_zip

{ width: 234px; }
 * 1) card_email

{ padding-top: 1em; padding-bottom: 1em; }
 * 1) donate-button-block

.donate-button-div { padding-bottom: 3px; }

.donate-button { width: 16em; }

{ text-align:center; }
 * 1) separator-div

 //--form junk 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 };

function flagError(elem) { elem.style.borderColor = '#ff0000'; elem.style.color = '#ff0000'; }

function validateForm( form, paymentType ) {

var error = false;

// 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( ' '.replace('$1', minimums[currency] + ' ' + currency ) ); error = true; }

if (paymentType == 'cc') {

testElem = document.getElementById('card_name_first'); if(testElem.value == 'First') {   flagError(testElem); error = true; }

testElem = document.getElementById('card_name_last'); if(testElem.value == "Last") {   flagError(testElem); error = true; }

testElem = document.getElementById('card_address_street_1'); if(testElem.value == "Street") {   flagError(testElem); error = true; }

testElem = document.getElementById('card_address_city'); if(testElem.value == "City") {   flagError(testElem); error = true; }

testElem = document.getElementById('card_address_state'); if(testElem.value == "") {   flagError(testElem); error = true; }

testElem = document.getElementById('card_address_zip'); if(testElem.value == "Zip") {   flagError(testElem); error = true; }

testElem = document.getElementById('card_email'); if(testElem.value == "Email Address") {   flagError(testElem); error = true; }

if(error == true) {   alert('All fields must be filled in to process your donation.'); return false; }

else return true;

}

return !error; }

function DefaultSubmit(formfield, Action) //This function manages the submit action of the form. { var keycode; if (window.event) {   keycode = window.event.keyCode; } else if (Action) {   keycode = Action.which; } else return true;

if (keycode == 13) {   if (document.getElementById('cc-donate-button').style.display == "block") {     redirectPayment('cc'); }   else if (document.getElementById('paypal-donate-button').style.display == "block") {     redirectPayment('pp'); }   return false; } else return true; }

function redirectPayment(paymentType) //This function directs the payment to the proper method. { if (paymentType == 'cc') {   var paymentType = 'cc'; var action_url = "https://payments.wikimedia.org/index.php/Special:PayflowProGateway?uselang= \x26masthead=\x26form_name=\x26text_template=\x26language=\x26ffname= " ; } if (paymentType == 'pp') {   action_url="https://wikimediafoundation.org/wiki/Special:ContributionTracking/  "; }

document.paypalcontribution.action = action_url; document.paypalcontribution.utm_source.value = getQuerystring( 'utm_source' ) + '.' + getLandingPage + '.' + paymentType; if(validateForm(document.paypalcontribution,paymentType)) {   document.paypalcontribution.fname.value = document.paypalcontribution.card_name_first.value; document.paypalcontribution.lname.value = document.paypalcontribution.card_name_last.value;

document.paypalcontribution.street.value = document.paypalcontribution.card_address_street_1.value; document.paypalcontribution.address1.value = document.paypalcontribution.card_address_street_1.value;

document.paypalcontribution.city.value = document.paypalcontribution.card_address_city.value; document.paypalcontribution.state.value = document.paypalcontribution.card_address_state.value;

//document.paypalcontribution.zip.value = document.paypalcontribution.card_address_zip.value; document.paypalcontribution.zip.value = document.paypalcontribution.card_address_zip.value;

document.paypalcontribution.email.value = document.paypalcontribution.card_email.value; document.paypalcontribution.emailAdd.value = document.paypalcontribution.card_email.value;

if(typeof(OWA) !== 'undefined') {     OWATracker.shareStateByPost( document.paypalcontribution ); }   document.paypalcontribution.submit; } }

        

 

   <input type="hidden" name="country" id="country" value="US" />

<input type="hidden" name="email" value="" /> <input type="hidden" name="emailAdd" value="" />

<p style="font-weight: bold;"> <input type="button" value=" " class="button" onclick="redirectPayment('pp');"/> <input name="currency_code" id="input_currency_code" type="hidden" value="USD" />

Name <input type="text" class="card-input" id="card_name_first" name="fname" value="First" onfocus="clearThis(this,'First');" onblur="resetThis(this,'First');"/> <input type="text" class="card-input" id="card_name_last" name="lname" value="Last" onfocus="clearThis(this,'Last');" onblur="resetThis(this,'Last');" /> Address <input type="text" class="card-input" id="card_address_street_1" value="Street" onfocus="clearThis(this,'Street');" onblur="resetThis(this,'Street');" /> <input type="text" class="card-input" id="card_address_city" value="City" onfocus="clearThis(this,'City');" onblur="resetThis(this,'City');" /> <select id="card_address_state" size="1" onclick="recolorThis(this);">

<script type="text/javascript"> var stateList = [ ]; var opt = document.createElement("option"); opt.selected = true; opt.text = ""; opt.value = ""; document.getElementById("card_address_state").options.add(opt);

for(i=0; i<stateList.length; i++) {       opt = document.createElement("option"); opt.text = stateList[i]; opt.value = stateList[i]; document.getElementById("card_address_state").options.add(opt); }

<input type="text" class="card-input" id="card_address_zip" value="Zip" onfocus="clearThis(this,'Zip');" onblur="resetThis(this,'Zip');" /> E-mail <input type="text" class="card-input" id="card_email" value="Email Address" onfocus="clearThis(this,'Email Address');" onblur="resetThis(this,'Email Address');" />

<input type="button" value=" " class="button" onclick="redirectPayment('cc');"/>

* *  * <p style="margin-top: 1em;">

<script type="text/javascript"> function getQuerystring( key ) { key = key.replace( /[\[]/, '\\\[' ).replace( /[\]]/, '\\\]' ); var regex = new RegExp( '[\\?&]' + key + '=([a-zA-Z0-9\_\-]*)' ); var qs = regex.exec( window.location.search ); return qs == null ? '' : qs[1]; }

function getLandingPage { var path = " ";

if( path == "default") { pathArray = window.location.pathname.split( '/' ); return pathArray[2]; } else return path; }

function updateCC( currency ) { if ( ( currency == 'AUD' ) || ( currency == 'CAD' ) || ( currency == 'EUR' ) ||    (currency == 'GBP' ) || ( currency == 'JPY' ) || ( currency == 'USD' ) ) { document.getElementById('cc-donate-button').style.display = " "; } else { document.getElementById('cc-donate-button').style.display = "none"; } }

function clearThis(elem,initialString) //This function empties the "Other" Box. { elem.style.color = "#000000"; elem.style.borderColor = '#C0C0C0'

if(elem.value == initialString) elem.value = ""; }

function resetThis(elem,resetString) { if(elem.value == "") {   elem.style.color = "#999999"; elem.value = resetString; } elem.style.borderColor = '#C0C0C0'; }

function recolorThis(elem) { elem.style.color = "#000000"; elem.style.borderColor = '#C0C0C0'; }

document.paypalcontribution.utm_medium.value = getQuerystring( 'utm_medium' ); document.paypalcontribution.utm_campaign.value = getQuerystring( 'utm_campaign' ); document.paypalcontribution.country.value = getQuerystring ( 'country' ); document.paypalcontribution.referrer.value = document.referrer;

( function( $ ) { $(document).ready(function{ var currency = $("#input_currency_code").val; updateCC(currency); }) } )( jQuery );