I have designed a Forms process using the New Designer on LF Cloud and I have provided two buttons on the form, one for "Approve" and the other one for "Reject".
I would like the form to enforce "Comments" to be provided if they press on the "Reject" button.
I have seen a code sample in the Laserfiche documentation that seems very close to do what I need but I'm trying to get that "Comments" field content using the following code:
LFForm.onFormSubmission(async function (event) {
// Get the value of the clicked submission button
const userAction = event.data.action.value;
const approvalComments = LFForm.getFieldValues({ fieldId: 2});
if (userAction === "Reject" && approvalComments === "") {
await LFForm.showFields({ fieldId: 2 });
return {error: "Please add comments in order to approve."};
} else {
await LFForm.hideFields({ fieldId: 2 });
}
});
In that example, it is using field 2 but wondering how can I get the "Comments" system multi-line input value...