var currentRowId=1; var banktype = "bank-eu"; function renumberTableRows(){ var row_no=1; var table = document.getElementById("tabbody"); for (var i = 0, row; row = table.rows[i]; i++) { // row.cells[0].innerHTML=row_no++; } } function isFloat(val) { var floatRegex = /^-?\d+(?:[.,]\d*?)?$/; if (!floatRegex.test(val)) return false; val = parseFloat(val); if (isNaN(val)) return false; return true; } function deleteTableRow(rowId){ var target = document.getElementById("upload-target"+rowId); // this.message = app.message; // var children = target.children; // delete all uploaded elements /* for (var i = 0; i < children.length; i++) { var tmp = children[i].getAttribute("data-id"); alert ("DEL"); alert (tmp); $K.ajax.post({ url: 'delete.php', data: 'id='+tmp, before: function(xhr) {}, success: function(response) {}, error: function(response) {} }); } */ // delete the row from table var element = document.getElementById("trow"+rowId); element.parentNode.removeChild(element); renumberTableRows(); // alert(rowId); } function countRows(){ var ctr=0; for (i=0; i${a_type} // `; // add coluemn for a_type (Auslagenart) // e += ` `; e += `${a_date} `; // add column for date // e += ``; e += `${a_description} `; // add column for num e += `${a_amount} `; // add column for file upload /* e+= `
*/ e += `${a_currency}`; // `; // add delete bnutton e += ` `; $node.append(element); element.innerHTML=(e); // renumberTableRows(); currentRowId++; reset2(); } function setUploadField() { var e = $K.dom('#uploadfield'); var uf =`
Beleg hochladen
`; document.getElementById("uploadfield").innerHTML=uf; } $K.add('module', 'kaform', { init: function(app, context) { this.app = app; this.message = app.message; }, // catch event onmessage: { tabs: { opened: function(sender) { console.log('Tab box is ',sender.getActiveBox().nodes[0]); banktype = sender.getActiveBox().nodes[0].attributes.id.value; console.log(banktype); // console.log(sender); // this.message.show({ message: 'My message' }); } } }, }); $K.init({ observer: true }); // startup is here // on startup clear session on server $K.ajax.get({ url: 'clear.php', data: '', // or key=value object before: function(xhr) {}, success: function(response) {}, error: function(response) {} }); setUploadField(); function check_field(fieldid,message){ var f = document.getElementById(fieldid).value; if (! f.trim().length ) { document.getElementById(fieldid).focus(); showAlert(message) return false; } return true; } // add on table row //addTableRow(); // // // function downloadDocument() { /* if (!check_field("nickname", "Bitte gib deinen Nicknamen an!")) return; */ if (!check_field("realname", "Bitte gib deinen Realnamen an!")) return; if (!check_field("email", "Bitte gib deinen E-Mail-Adresse an!")) return; if (!check_field("projectid", "Bitte gib idie Projekt-ID an!")) return; if (countRows()==0){ document.getElementById("a_description").focus(); showAlert("Bitte füge mind. eine Auslage hinzu!"); return; } if (banktype == "bank-eu"){ iban = document.getElementById('iban'); if (!IBAN.isValid(iban.value)){ document.getElementById("iban").focus(); showAlert("Bitte gib eine korrekte IBAN ein!"); return; } if (!document.getElementById('bic').value.trim().length){ document.getElementById("bic").focus(); showAlert("Bitte gib einen koreekte BIC an!"); return; } } if (banktype == "bank-paypal"){ ii = document.getElementById('paypal'); if (!document.getElementById('paypal').value.trim().length){ document.getElementById("paypal").focus(); showAlert("Bitte gib einen PayPal Account an!"); return; } } document.getElementById('banktype').value=banktype; document.getElementById("theform").submit(); } /* function checkIban() { iban = document.getElementById('iban'); if(IBAN.isValid(iban.value)) if( document.getElementById('eu').checked ) { if(IBAN.isValid(iban.value)) { if(iban.classList.contains('invalid')) iban.classList.remove('invalid'); iban.classList.add('valid'); } else { if(iban.classList.contains('valid')) iban.classList.remove('valid'); iban.classList.add('invalid'); } } else { if(iban.classList.contains('invalid')) iban.classList.remove('invalid'); if(iban.classList.contains('valid')) iban.classList.remove('valid'); } } */