Modifs ajout {form_field}
This commit is contained in:
parent
2014dff1a1
commit
8adc144bfa
5 changed files with 93 additions and 134 deletions
43
templates/_js.tpl
Normal file
43
templates/_js.tpl
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
<script type="text/javascript">
|
||||
{literal}
|
||||
|
||||
function updateSum(){
|
||||
var total = 0;
|
||||
e = document.querySelectorAll('input[name="prix[]"]');
|
||||
e.forEach( function sum(item, index){
|
||||
total = total + Number(item.value);
|
||||
});
|
||||
document.getElementById('total').innerHTML = total.toFixed(2);
|
||||
}
|
||||
|
||||
(function () {
|
||||
|
||||
function plus(){
|
||||
var newdiv = document.createElement('tr');
|
||||
newdiv.innerHTML = document.getElementById('Line1').innerHTML;
|
||||
document.getElementById('Lines').appendChild(newdiv);
|
||||
}
|
||||
plus();
|
||||
|
||||
$('#ajouter_ligne').onclick = plus;
|
||||
|
||||
function changeTypeSaisie(type)
|
||||
{
|
||||
g.toggle(['.type_client', '.type_membre'], false);
|
||||
g.toggle('.type_' + type, true);
|
||||
}
|
||||
|
||||
changeTypeSaisie(document.forms[0].base_receveur.value);
|
||||
|
||||
var inputs = $('input[name="base_receveur"]');
|
||||
|
||||
for (var i = 0; i < inputs.length; i++)
|
||||
{
|
||||
inputs[i].onchange = function (e) {
|
||||
changeTypeSaisie(this.value);
|
||||
};
|
||||
}
|
||||
|
||||
} ());
|
||||
{/literal}
|
||||
</script>
|
||||
Loading…
Add table
Add a link
Reference in a new issue