Is there a way to populate a Status field on a form depending on whether an approver "Approved" or "Rejected"?
Bernie
Is there a way to populate a Status field on a form depending on whether an approver "Approved" or "Rejected"?
Bernie
Hello Bernard,
I was able to populate an input with Approved or Rejected based on whether the form was approved or rejected in the task list using this code:
$(document).ready(function() { $(".action-btn.Approve").on('click', function() { $("#q1 input").val("Approved"); }); $(".action-btn.Reject").on('click', function() { $("#q1 input").val("Rejected"); }); });
What this does is set the value of the input whenever the Reject or Approved button is clicked.
Hope this helps!
Thanks Winston
I am sure this will work. Will try it out later. I forgot to ask the more complicated part of my question. Here goes...
Is it possible to capture the approval or rejection right on the form? By that I mean, the field "Status" is actually a part of the form. When the approver presses either button, that field on the form is updated with the appropriate value so that when that form is saved into the LF repository as an image, the image actually shows the "Status" field and the value "Approved" or "Rejected"?
Thanks in advance,
Bernie
No problem Bernard,
Yeah it should put the an Approved or Rejected value in an input box. The above code will produce these results:
So upon clicking the Approve or Reject button in the tasks, the Submit text box will contain "Approved" or "Rejected".
Here is what the saved Form looks like in the repository:
Hope that further clarifies the code above!
Is it possible to populate a signature or input field with the date/time and user who approved the form? It would be convenient to use their approval as a form of signature and have it viewable on the form and end result in Laserfiche.
@████████, Create a date field:
Then capture the timestamp:
$(document).ready(function(){ //clears signature date and time $('#q189 input').attr("readonly", false); $('#q189 input').val(""); $('#q189 input').attr("readonly", true); //capture timestamp $('.Approve, .Reject').click(timestamp); function timestamp() { var d = new Date(); var minutes = d.getMinutes(); var hours = d.getHours(); var fullYear = d.getFullYear(); var day = d.getDate(); //returns day as 1-31 var month = d.getMonth() + 1; //getMonth returns month as 0-11 var fullDate = month + "/" + day + "/" + fullYear; if (minutes < 10) {var minutes = "0" + minutes;} if (d.getHours() < 12) {var a = "AM";} else if (d.getHours() == 12) {var a = "PM";} else {var a = "PM"; hours = hours - 12;} if ($(this).hasClass('Approve')) { $('#q189 input').attr("readonly", false); $('#q189 input').val(fullDate + " " + hours + ":" + minutes + " " + a) $('#q189 input').attr("readonly", true); } else if ($(this).hasClass('Reject')) { $('#q189 input').attr("readonly", false); $('#q189 input').val(""); $('#q189 input').attr("readonly", true); } }; }); //close document.ready
Thanks Winston
I will try this out for sure.
Bernie