...
Custom Approve, Reject and More Info Button
The purpose of this JS code is to custom some buttons in a Dynaform. The first three lines change the color of the buttons. And then it is added a JS function on the on-click event of the button so it can route the flow to the next task based on a condition.
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
// Change the size and color of the buttons document.getElementById('form[rejectBtn]').setAttribute("style","background:red;border:1px solid #eeeeee;width:150px;"); document.getElementById('form[approveBtn]').setAttribute("style","background:green;border:1px solid #eeeeee;width:150px;"); document.getElementById('form[moreinfoBtn]').setAttribute("style","background:#3397e1;border:1px solid #eeeeee;width:150px;"); // Add events on the buttons document.getElementById('form[rejectBtn]').onclick = function() { document.getElementById("form[approval]").value = '2'; document.forms[0].submit(); } document.getElementById('form[approveBtn]').onclick = function() { document.getElementById("form[approval]").value = '1'; document.forms[0].submit(); } document.getElementById('form[moreinfoBtn]').onclick = function() { document.getElementById("form[approval]").value = '3'; document.forms[0].submit(); } |
...