Files
@ 564e40829f80
Branch filter:
Location: kallithea/pylons_app/templates/index2.html
564e40829f80
3.8 KiB
text/html
initial commit.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | ## -*- coding: utf-8 -*-
<%inherit file = "base/base.html"/>
<%def name="page_title()">
${_('Wire transfer')}
</%def>
<%def name="body()">
<h3> ${h.link('Home','/')} / ${_('Wire transfer')}</h3>
${h.secure_form('/home/make_payment',method='post',id="secure_form")}
##Secure Form Tag for prevention of Cross-site request forgery (CSRF) attacks.
##Generates form tags that include client-specific authorization tokens to be verified by the destined web app.
<table class="editor_disp">
<tr>
<td colspan="3">${h.get_error('_authentication_token',c.form_errors)}</td>
</tr>
<tr>
<td class="label">${_('Account number')}</td>
<td>${h.text('account_number',size=44,maxlength=38)}</td>
<td id="e_account_number">${h.get_error('account_number',c.form_errors)}</td>
</tr>
<tr>
<td class="label">${_('Title')}</td>
<td>${h.textarea("title", "", cols=43, rows=5,maxlength=20)}</td>
<td id="e_title">${h.get_error('title',c.form_errors)}</td>
</tr>
<tr>
<td class="label">${_('Recipient')}</td>
<td>${h.select('recipient',1,c.recipients_list)}</td>
<td id="e_recipient">${h.get_error('recipient',c.form_errors)}</td>
</tr>
<tr>
<td class="label">${_('Recipient address')}</td>
<td>${h.text('recipient_address',size=44)}</td>
<td id="e_recipient_address">${h.get_error('recipient_address',c.form_errors)}</td>
</tr>
<tr>
<td class="label">${_('Amount')}</td>
<td>${h.text('amount',size='7')}zł</td>
<td id="e_amount">${h.get_error('amount',c.form_errors)}</td>
</tr>
<tr>
<td class="label"></td>
<td>${h.submit('send',_('send'))}</td>
</tr>
</table>
${h.end_form()}
${c.name}
<script type="text/javascript">
YAHOO.util.Event.onDOMReady(function(){
var D = YAHOO.util.Dom;
var E = YAHOO.util.Event;
function set_error_msg(id_ele,err_msg){
ele = D.get(id_ele);
if(ele){
ele.innerHTML = '<span class="error_msg">'+err_msg+'</span>';
}
};
function clear_error_msg(id_ele){
ele = D.get(id_ele);
if(ele){
ele.innerHTML = '<span style="color:green">ok</span>';
}
};
function validation(){
//Clean the "fishy" fields :)
an = D.get('account_number');
an.value = String(an.value).replace(/ /g,'').replace(/-/g,'');
am = D.get('amount');
am.value = String(am.value).replace(/,/g,'.').replace(';','.');
//console.log(an.value.length);
//ok we cleaned a little bit now validate the account...
if(!/^[0-9]{26}$/.test(an.value)){
set_error_msg('e_account_number','${_("Account number is invalid, it must be 26 digits")}');
return false;
}
else{
clear_error_msg('e_account_number');
return true;
}
};
E.addListener(['account_number','amount'],'keyup',function(e){
if (validation()){
return true;
}
return false;
});
E.addListener('secure_form','submit',function(e){
if (!validation()){
//this will hold the event == form submition
E.stopEvent(e);
}
})
});
</script>
</%def>
|