Template:2011FR/Form-section-radiobuttons: Difference between revisions

From Donate
Jump to navigation Jump to search
Content deleted Content added
Jalexander (talk | contribs)
try to fix other box/session handling
mNo edit summary
 
(19 intermediate revisions by 4 users not shown)
Line 15: Line 15:


#input_amount_other_box{
#input_amount_other_box{
color: #aaaaaa;
/* color: #aaaaaa; */
color: black;
font-size: 0.8em;
font-size: 0.8em;
border:1px solid #c0c0c0;
border:1px solid #c0c0c0;
Line 75: Line 76:


function resetOther(box){
function resetOther(box){
//box.value = "</html>{{int:donate_interface-other}}<html>";
box.value = "</html>{{int:donate_interface-other}}<html>";
box.value = "</html>{{int:donate_interface-other}}<html>";
box.style.color = "#aaaaaa";
//box.style.color = "#aaaaaa";
}
}


function selectAmount(){
function selectAmount(){
document.getElementById("input_amount_other_box").value = "</html>{{int:donate_interface-other}}<html>";
//document.getElementById("input_amount_other_box").value = "</html>{{int:donate_interface-other}}<html>";
document.getElementById("input_amount_other_box").style.color = "#aaaaaa";
document.getElementById("input_amount_other_box").value = "";
//document.getElementById("input_amount_other_box").style.color = "#aaaaaa";
}
document.getElementsByName("amountGiven")[0].value="";

function validateForm(form){

var minimums = {
'USD' : 1,
'AED' : 4,
'ARS' : 4,
'AUD' : 1,
'BBD' : 2,
'BDT' : 76,
'BGN' : 1.4,
'BHD' : 0.4,
'BMD' : 1,
'BND' : 1.3,
'BOB' : 7,
'BRL' : 1.7,
'BSD' : 1,
'BZD' : 2,
'CAD' : 1,
'CHF' : 0.9,
'CLP' : 494,
'CNY' : 6,
'COP' : 1910,
'CRC' : 512,
'CZK' : 18,
'DKK' : 5,
'DOP' : 38,
'DZD' : 73,
'EEK' : 11,
'EGP' : 6,
'EUR' : 0.7,
'GBP' : 0.6,
'GTQ' : 7.8,
'HKD' : 7.7,
'HNL' : 19,
'HRK' : 5,
'HUF' : 219,
'IDR' : 8960,
'ILS' : 3.6,
'INR' : 49,
'JMD' : 85,
'JOD' : 0.7,
'JPY' : 78,
'KES' : 97,
'KRW' : 1127,
'KYD' : 0.8,
'KZT' : 147,
'LBP' : 1500,
'LKR' : 110,
'LTL' : 2.5,
'LVL' : 0.5,
'MAD' : 8.1,
'MKD' : 45,
'MUR' : 29,
'MVR' : 15,
'MXN' : 13,
'MYR' : 3,
'NOK' : 5.5,
'NZD' : 2,
'OMR' : 4,
'PAB' : 1,
'PEN' : 4,
'PHP' : 43,
'PKR' : 86,
'PLN' : 3,
'PYG' : 4190,
'QAR' : 4,
'RON' : 4,
'RUB' : 30,
'SAR' : 4,
'SEK' : 7,
'SGD' : 1.2,
'SVC' : 9,
'THB' : 30,
'TJS' : 4.7,
'TND' : 2,
'TRY' : 2,
'TTD' : 6,
'TWD' : 30,
'UAH' : 8,
'UYU' : 19,
'UZS' : 1760,
'VND' : 21000,
'XAF' : 470,
'XCD' : 2.7,
'XOF' : 476,
'ZAR' : 7.8
};

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 != "</html>{{int:donate_interface-other}}<html>" ) {
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 ) {
alert( '</html>{{{validation-error-minimum|You must contribute at least $1}}}<html>'.replace('$1', minimums[currency] + ' ' + currency ) );
error = true;
}
return !error;
}
}


Line 219: Line 101:
//return false;
//return false;
}
}

var monthlyDonation = false;
//This line is needed to prevent errors from a if statement in the "form-section-processing" template

</script>
</script>


<input type="hidden" name="currency_code" value="</html>{{{currency|{{2011FR/core-currency-code|{{{country}}}}}}}}<html>"/>
<input type="hidden" name="currency_code" value="</html>{{{currency|{{2011FR/core-currency-code|{{{country}}}}}}}}<html>"/>

<!--
<div>
<div id="radiobuttons-table-header">
</html>{{int:donate_interface-amount-legend}} {{{currency-symbol}}}<html>
</div>
</div>
-->


<div>
<div>
<div id="radiobuttons-table-header">
<div id="radiobuttons-table-header">
</html>{{int:donate_interface-amount-legend}}<html> </html>{{2011FR/core-currency-symbol|{{{currency|{{2011FR/core-currency-code|{{{country}}}}}}}}}}<html>
</html>{{int:donate_interface-amount-legend}}<html>: <div style="display: inline;"></html>{{2011FR/core-currency-symbol|{{{currency|{{2011FR/core-currency-code|{{{country}}}}}}}}}}<html></div> <div style="display: inline;"></html>({{{currency|{{2011FR/core-currency-code|{{{country}}}}}}}})<html></div>
</div>
</div>
<div class="collapsible-container-trigger" id="country-container" style="display: none; cursor: pointer;" onclick="triggerClick('country');">
<div class="collapsible-container-trigger" id="country-container" style="display: none; cursor: pointer;" onclick="triggerClick('country');">
Line 240: Line 118:
<span class="currency-collapsible-container-contained" id="country-container-contained">
<span class="currency-collapsible-container-contained" id="country-container-contained">
<select id="currency-select" style="font-size: 0.5em;" onchange="loadCountry();">
<select id="currency-select" style="font-size: 0.5em;" onchange="loadCountry();">
<option value="</hmtl>{{{country}}}<html>" selected></html>{{{currency|{{2011FR/core-currency-code|{{{country}}}}}}}}<html> – </html>{{2011FR/core-currency-symbol|{{{currency{{2011FR/core-currency-code|{{{country}}}}}}}}}}<html></option>
<option value="</html>{{{country}}}<html>" selected="selected"></html>{{{currency|{{2011FR/core-currency-code|{{{country}}}}}}}}<html> – </html>{{2011FR/core-currency-symbol|{{{currency{{2011FR/core-currency-code|{{{country}}}}}}}}}}<html></option>
</html>{{#tag:html|{{#ifeq:{{{currency|{{2011FR/core-currency-code|{{{country}}}}}}}}|USD||<option value="USD">USD – $</option>}}}}<html>
</html>{{#tag:html|{{#ifeq:{{{currency|{{2011FR/core-currency-code|{{{country}}}}}}}}|USD||<option value="USD">USD – $</option>}}}}<html>
</html>{{#tag:html|{{#ifeq:{{{currency|{{2011FR/core-currency-code|{{{country}}}}}}}}|EUR||<option value="EUR">EUR – €</option>}}}}<html>
</html>{{#tag:html|{{#ifeq:{{{currency|{{2011FR/core-currency-code|{{{country}}}}}}}}|EUR||<option value="EUR">EUR – €</option>}}}}<html>
Line 279: Line 157:
</td>
</td>
<td class="amount-table-cell">
<td class="amount-table-cell">
<input type="radio" name="amount" id="input_amount_6" onclick="selectAmount();" valury te="</html>{{{donate-amount-6}}}<html>" />
<input type="radio" name="amount" id="input_amount_6" onclick="selectAmount();" value="</html>{{{donate-amount-6}}}<html>" />
<label for="input_amount_6"></html>{{{donate-amount-6}}}<html></label>
<label for="input_amount_6"></html>{{{donate-amount-6}}}<html></label>
</td>
</td>
<td class="amount-table-cell">
<td class="amount-table-cell">
<input type="radio" name="amount" id="input_amount_other" value="Other" /><input type="text" id="input_amount_other_box" size="3" autocomplete="off" value="</html>{{int:donate_interface-other}}<html>" onfocus="clearOther(this)"/>
<input type="radio" name="amount" id="input_amount_other" value="Other" onclick="document.getElementById('input_amount_other_box').focus();"/>
<label for="input_amount_other"></html>{{int:donate_interface-other}}<html></label>
<!-- <input type="text" id="input_amount_other_box" size="3" autocomplete="off" />-->
<!-- <input type="text" id="input_amount_other_box" size="3" autocomplete="off" value="</html>{{int:donate_interface-other}}<html>" onfocus="clearOther(this)"/> -->
<input type="text" id="input_amount_other_box" size="3" autocomplete="off" value="" onfocus="clearOther(this)"/>
</td>
</td>
</tr>
</tr>

Latest revision as of 20:18, 24 January 2012

Donation amount:
$
(USD)