You are viewing limited content. For full access, please sign in.

Question

Question

Form Designer js for requiring a comment when Rejected

asked on November 29, 2023

We're looking to convert the what used to work for validating that the comment box is not blank when a user is rejecting a form no longer works in the new designer, as stated in the documentation for the new form designer.  

$(document).ready(function () {

   $(".Reject").click(function () {
   
        if ($("#comments").val() == "") {
            alert("Please enter a comment before selecting this action");
            return false;
        }
    });
  
}

We're wanting a new forms editor js version of this, that we would think should look something like this 

LFForm.onFormSubmission(function () {
	
  
  if(LFForm.findFieldsByClassName("comments") == "" )(
    alert('Please enter a comment before selecting this action')
    return false;
  )  

  //console.log(LFForm.findFieldsById("comments"));

});

Except onFormSubmission doesn't seem to be getting triggered and there doesn't appear to be an onclick event yet supported to just check for a '.Reject' to be clicked. 

1 0

Replies

replied on November 29, 2023

Others may have a better solution, but we've included a radio button to select the desired action (approve, reject, etc.) and then just have a Submit button on the form.

We then use the Field Rules to validate the Task Comments box as required based on that radio button. 

validate_required_comments.jpg
2 0
replied on November 29, 2023

That's how we do it as well. Until Laserfiche adds Field Rule options to make specific fields (or the built in task comment) required or optional based on which Action Button is selected, what Jennifer posted above has been the best option for us.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.