diff --git a/src/Template/TransactionCreations/create_multi.ctp b/src/Template/TransactionCreations/create_multi.ctp index 635c1b869..cf82ee374 100644 --- a/src/Template/TransactionCreations/create_multi.ctp +++ b/src/Template/TransactionCreations/create_multi.ctp @@ -60,7 +60,7 @@ $this->assign('title', __('Schöpfungstransaktion'));
Form->control('memo'); ?> - Form->control('amount'); ?> + Form->control('amount', ['required' => false]); ?> 10000000) { @@ -80,7 +80,7 @@ $this->assign('title', __('Schöpfungstransaktion')); <>
- Form->text('user_amount[' . $possibleReceiver['id'] . ']', ['placeholder' => __('Für benutzerdefinierten Betrag'), 'type' => 'number', 'step' => '0.01', $disable]); ?> GDD + Form->text('user_amount[' . $possibleReceiver['id'] . ']', ['placeholder' => __('Für benutzerdefinierten Betrag'), 'class' => 'user_amount', 'type' => 'number', 'step' => '0.01', $disable]); ?> GDD
@@ -127,4 +127,54 @@ $this->assign('title', __('Schöpfungstransaktion')); } } } + + // cross browser dom is ready module from: +// https://www.competa.com/blog/cross-browser-document-ready-with-vanilla-javascript/ +var domIsReady = (function(domIsReady) { + var isBrowserIeOrNot = function() { + return (!document.attachEvent || typeof document.attachEvent === "undefined" ? 'not-ie' : 'ie'); + } + + domIsReady = function(callback) { + if(callback && typeof callback === 'function'){ + if(isBrowserIeOrNot() !== 'ie') { + document.addEventListener("DOMContentLoaded", function() { + return callback(); + }); + } else { + document.attachEvent("onreadystatechange", function() { + if(document.readyState === "complete") { + return callback(); + } + }); + } + } else { + console.error('The callback is not a function!'); + } + } + + return domIsReady; +})(domIsReady || {}); + +(function(document, window, domIsReady, undefined) { + domIsReady(function() { + var userAmountInputs = document.getElementsByClassName("user_amount"); + for(var i in userAmountInputs) { + var input = userAmountInputs[i]; + //console.log("input: %o", input); + if(input.parentNode != undefined) { +// var checkbox = input.parentNode.previousElementSibling.previousElementSibling; + //console.log("checkbox: %o?", checkbox); + input.onfocus = function(e) { + var checkbox = e.target.parentNode.previousElementSibling.previousElementSibling; + checkbox.checked = true; + //console.log("onFocus checkbox: %o", checkbox); + } + } + } + }); +})(document, window, domIsReady); + + // + \ No newline at end of file