I have been trying to write some JS/JQuery code based on other examples I've seen for similar requirements, but I'm getting nowhere. I am not a developer and only know enough JS to be dangerous.
I need a button click to submit the answer to a question and populate a people picker field with the current user and a date field with the current date. Below is the code I have written in the form's custom Javascript field:
function SetAnswerInfo() {
NWF$ ("#" + varAnswerBy).val(Current User);
NWF$ ("#" + varAnswerDate).val(Current Date);
}
And in the button's client click field:
NWF$(document).ready(function(){
SetAnswerInfo();
});
The fields to populate are on the form, but hidden behind the header since marking them not visible causes the form not to load. Both fields have been assigned the JS variables shown in the code above.
I am also using the button's "Connected to" feature to set the submission's status to "Answered".
The status is set as expected, but the code is not populating the Answered by and Date Answered fields.
Any ideas what I'm doing wrong?
Thanks!