Template:2011FR/Form-section-radiobuttons: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
No edit summary |
No edit summary |
||
Line 37: | Line 37: | ||
box.value = "</html>{{{donate-amount-other|<html>Other:</html>}}}<html>"; |
box.value = "</html>{{{donate-amount-other|<html>Other:</html>}}}<html>"; |
||
box.style.color = "#aaaaaa"; |
box.style.color = "#aaaaaa"; |
||
} |
|||
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.amountGiven.value != "</html>{{{donate-amount-other|<html>Other:</html>}}}<html>" ) { |
|||
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 ) ); |
|||
error = true; |
|||
} |
|||
return !error; |
|||
} |
} |
||
Line 48: | Line 103: | ||
<tr> |
<tr> |
||
<td class="amount-table-cell"> |
<td class="amount-table-cell"> |
||
<input type="radio" name="amount" id="input_amount_0" onclick="document.paypalcontribution. |
<input type="radio" name="amount" id="input_amount_0" onclick="document.paypalcontribution.amountGiven.value = ''" value="</html>{{{donate-amount-0|5}}}<html>" /> |
||
<label for="input_amount_0"></html>{{#ifeq:{{{currency-position}}}|before|{{{currency-symbol}}}|}}{{{donate-amount-0|5}}}{{#ifeq:{{{currency-position}}}|after|{{{currency-symbol}}}|}}<html></label> |
<label for="input_amount_0"></html>{{#ifeq:{{{currency-position}}}|before|{{{currency-symbol}}}|}}{{{donate-amount-0|5}}}{{#ifeq:{{{currency-position}}}|after|{{{currency-symbol}}}|}}<html></label> |
||
</td> |
</td> |
||
<td class="amount-table-cell"> |
<td class="amount-table-cell"> |
||
<input type="radio" name="amount" id="input_amount_1" onclick="document.paypalcontribution. |
<input type="radio" name="amount" id="input_amount_1" onclick="document.paypalcontribution.amountGiven.value = ''" value="</html>{{{donate-amount-1|10}}}<html>" /> |
||
<label for="input_amount_1"></html>{{#ifeq:{{{currency-position}}}|before|{{{currency-symbol}}}|}}{{{donate-amount-1|10}}}{{#ifeq:{{{currency-position}}}|after|{{{currency-symbol}}}|}}<html></label> |
<label for="input_amount_1"></html>{{#ifeq:{{{currency-position}}}|before|{{{currency-symbol}}}|}}{{{donate-amount-1|10}}}{{#ifeq:{{{currency-position}}}|after|{{{currency-symbol}}}|}}<html></label> |
||
</td> |
</td> |
||
<td class="amount-table-cell"> |
<td class="amount-table-cell"> |
||
<input type="radio" name="amount" id="input_amount_2" onclick="document.paypalcontribution. |
<input type="radio" name="amount" id="input_amount_2" onclick="document.paypalcontribution.amountGiven.value = ''" value="</html>{{{donate-amount-2|20}}}<html>" /> |
||
<label for="input_amount_2"></html>{{#ifeq:{{{currency-position}}}|before|{{{currency-symbol}}}|}}{{{donate-amount-2|20}}}{{#ifeq:{{{currency-position}}}|after|{{{currency-symbol}}}|}}<html></label> |
<label for="input_amount_2"></html>{{#ifeq:{{{currency-position}}}|before|{{{currency-symbol}}}|}}{{{donate-amount-2|20}}}{{#ifeq:{{{currency-position}}}|after|{{{currency-symbol}}}|}}<html></label> |
||
</td> |
</td> |
||
<td class="amount-table-cell"> |
<td class="amount-table-cell"> |
||
<input type="radio" name="amount" id="input_amount_3" onclick="document.paypalcontribution. |
<input type="radio" name="amount" id="input_amount_3" onclick="document.paypalcontribution.amountGiven.value = ''" value="</html>{{{donate-amount-3|35}}}<html>" /> |
||
<label for="input_amount_3"></html>{{#ifeq:{{{currency-position}}}|before|{{{currency-symbol}}}|}}{{{donate-amount-3|35}}}{{#ifeq:{{{currency-position}}}|after|{{{currency-symbol}}}|}}<html></label> |
<label for="input_amount_3"></html>{{#ifeq:{{{currency-position}}}|before|{{{currency-symbol}}}|}}{{{donate-amount-3|35}}}{{#ifeq:{{{currency-position}}}|after|{{{currency-symbol}}}|}}<html></label> |
||
</td> |
</td> |
||
Line 66: | Line 121: | ||
<tr> |
<tr> |
||
<td class="amount-table-cell"> |
<td class="amount-table-cell"> |
||
<input type="radio" name="amount" id="input_amount_4" onclick="document.paypalcontribution. |
<input type="radio" name="amount" id="input_amount_4" onclick="document.paypalcontribution.amountGiven.value = ''" value="</html>{{{donate-amount-4|50}}}<html>" /> |
||
<label for="input_amount_4"></html>{{#ifeq:{{{currency-position}}}|before|{{{currency-symbol}}}|}}{{{donate-amount-4|50}}}{{#ifeq:{{{currency-position}}}|after|{{{currency-symbol}}}|}}<html></label> |
<label for="input_amount_4"></html>{{#ifeq:{{{currency-position}}}|before|{{{currency-symbol}}}|}}{{{donate-amount-4|50}}}{{#ifeq:{{{currency-position}}}|after|{{{currency-symbol}}}|}}<html></label> |
||
</td> |
</td> |
||
<td class="amount-table-cell"> |
<td class="amount-table-cell"> |
||
<input type="radio" name="amount" id="input_amount_5" onclick="document.paypalcontribution. |
<input type="radio" name="amount" id="input_amount_5" onclick="document.paypalcontribution.amountGiven.value = ''" value="</html>{{{donate-amount-5|100}}}<html>" /> |
||
<label for="input_amount_5"></html>{{#ifeq:{{{currency-position}}}|before|{{{currency-symbol}}}|}}{{{donate-amount-5|100}}}{{#ifeq:{{{currency-position}}}|after|{{{currency-symbol}}}|}}<html></label> |
<label for="input_amount_5"></html>{{#ifeq:{{{currency-position}}}|before|{{{currency-symbol}}}|}}{{{donate-amount-5|100}}}{{#ifeq:{{{currency-position}}}|after|{{{currency-symbol}}}|}}<html></label> |
||
</td> |
</td> |
||
<td class="amount-table-cell"> |
<td class="amount-table-cell"> |
||
<input type="radio" name="amount" id="input_amount_6" onclick="document.paypalcontribution. |
<input type="radio" name="amount" id="input_amount_6" onclick="document.paypalcontribution.amountGiven.value = ''" value="</html>{{{donate-amount-6|250}}}<html>" /> |
||
<label for="input_amount_6"></html>{{#ifeq:{{{currency-position}}}|before|{{{currency-symbol}}}|}}{{{donate-amount-6|250}}}{{#ifeq:{{{currency-position}}}|after|{{{currency-symbol}}}|}}<html></label> |
<label for="input_amount_6"></html>{{#ifeq:{{{currency-position}}}|before|{{{currency-symbol}}}|}}{{{donate-amount-6|250}}}{{#ifeq:{{{currency-position}}}|after|{{{currency-symbol}}}|}}<html></label> |
||
</td> |
</td> |
||
Line 80: | Line 135: | ||
<input type="radio" name="amount" id="input_amount_other" value="" /> |
<input type="radio" name="amount" id="input_amount_other" value="" /> |
||
</html>{{#ifeq:{{{currency-position}}}|before|{{{currency-symbol}}}|}}<html> |
</html>{{#ifeq:{{{currency-position}}}|before|{{{currency-symbol}}}|}}<html> |
||
<input type="text" name="amountGiven" id="input_amount_other_box" size=" |
<input type="text" name="amountGiven" id="input_amount_other_box" size="3" autocomplete="off" value="</html>{{{donate-amount-other|<html>Other:</html>}}}<html>" onfocus="clearOther(this)"/> |
||
</html>{{#ifeq:{{{currency-position}}}|after|{{{currency-symbol}}}|}}<html> |
</html>{{#ifeq:{{{currency-position}}}|after|{{{currency-symbol}}}|}}<html> |
||
</td> |
</td> |
Revision as of 08:27, 31 October 2011