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

From Donate
Jump to navigation Jump to search
Content deleted Content added
Cbarr (talk | contribs)
No edit summary
mNo edit summary
 
(26 intermediate revisions by 5 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,
'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
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 153: 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>"/>
<!--
<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|{{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');">
<span style="font-weight: bold; font-size: 1.2em"></html>{{2011FR/core-currency-symbol|{{2011FR/core-currency-code|{{{country}}}}}}}<html></span><span style="font-size: 0.6em">(Change?)</span>
<span style="font-weight: bold; font-size: 1.2em"></html>{{2011FR/core-currency-symbol|{{{currency|{{2011FR/core-currency-code|{{{country}}}}}}}}}}<html></span><span style="font-size: 0.6em">(Change?)</span>
<br/>
<br/>
<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>{{2011FR/core-currency-code|{{{country}}}}}<html> – </html>{{2011FR/core-currency-symbol|{{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:{{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:{{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>
</select>
</select>
</span>
</span>
Line 215: Line 161:
</td>
</td>
<td class="amount-table-cell">
<td class="amount-table-cell">
<input type="radio" name="amount" id="input_amount_other" value="" /><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)