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

Question

Question

Uncheck a Checkbox when a User Task Loads Form

asked on March 22, 2022

Hello,

I am hoping this can be done but please let me know if not.

I have a Form that the customer would like to partially complete and then re-assign it to someone else to finish filling out the Form.

To accomplish this we added a checkbox that the user would check if they would like the Form reassigned upon submission. When they check this box, it shows a drop-down with various users that they can choose to reassign it to. Once they hit submit, the Form is just sent to a second User Task to finish.

All the values remain in the Form since it is the same Form being sent around. This is because whatever User 1 fills out, we want it retained when it is sent to User 2 (they can reassign this as many times as they want, it is just essentially looping).

The problem with this is that the checkbox used to reassign the task also remains checked when sent to the second user (I expected this). What I am hoping I can do is put some JavaScript in place so that when User 2 opens the task that is now assigned to them, the JavaScript unchecks that checkbox automatically.

This way User 2 can then reselect it if they want to reassign but then if they don't want to reassign, they don't have to manually uncheck the checkbox every time.

Is there any JavaScript someone can provide that can do this? Please let me know if you need any additional clarification on the above info. We are using the new Forms in the Laserfiche Cloud.

Thanks,

Ashleigh

0 0

Answer

APPROVED ANSWER
replied on March 23, 2022

For simple variable updates, you can also consider using a Rule service task instead of WF, which should be slightly less heavy. In this case: Create a Formula rule that just returns boolean 'false', and then map the output to the form checkbox variable. 





As for clearning the File Upload field, I will check with Product for this request, it should be do-able. 

2 0
replied on March 23, 2022

Thanks Joey - that's even easier and we'll look at doing that now too.

Would this also work with File Upload fields?

0 0
replied on March 23, 2022

If we get the clearing FileUpload request in, yes, it will work. I've created this item in our backlog, and will update you if we can fit it in the next monthly release. Forms parse WF/Rules output parameters exactly the same, i.e., 'falsy' values such as null/ false/ empty string, will reset the form variable, uncheck the checkbox, and so on.

1 0
replied on March 23, 2022

Fantastic - thanks!

0 0

Replies

replied on March 22, 2022 Show version history

Hi Ashleigh,

Since it's Cloud I don't think there is any JS that will work (at the moment there's only a very limited amount of JS functionality that works in Cloud 'Modern Designer' forms).

However - would it be feasible to run a workflow in the Forms process between tasks? You can use the Assign Token variable in the workflow to simply push 'nothing' back to the check-box variable. So in essence that will clear the choice in the Form.

Process flow looks like this between the tasks:

Workflow service task settings look like this:

Workflow looks like this:

 

Modified token (which is an Output parameter back to the Form process) looks like this:

Note that you put 'nothing' as the new value, meaning the checkbox (or radio button in the case of our screen-shots) will be cleared.

Hope that helps.

1 0
replied on March 22, 2022

As a side-note to the above:

FEATURE REQUEST: At the moment text fields, dates, radio-buttons, drop-downs etc all seem to be able to be cleared using the method above.

@Laserfiche - please could we add a way of clearing 'File Upload' fields. We have a process where a form can go around a review loop several times, and documents are 'resubmitted' into the same file upload field for approval. The user has to manually delete the previously submitted file, and add a new one... however we would like to be able to use the above method to 'clear' the previously uploaded file. This can't be done at the moment (unavailable to select a file upload field as an output (or input) parameter).

Thanks.

1 0
replied on April 14, 2022

The 2022.4 release added support to clear File Upload fields with "falsy" output values (e.g. false or empty string) from WF and Rules. Old submission files will still be retained for viewing in monitoring history.

1 0
replied on April 14, 2022

Outstanding! Thanks for that, we'll implement it straight away 👍

0 0
replied on March 23, 2022

Thanks, everyone. I used the method Joey sent as the JavaScript does not work and I am unable to switch to Classic Forms.

Using the Rule Service Task worked perfectly.

1 0
replied on March 23, 2022

Not familiar with Cloud, and you might need to use the original form Designer to be able to add JavaScript, but the script to do this should be easy enough.

Just add the "UncheckOnLoad" CSS tag to your checkbox and add this JavaScript:

$(document).ready(function () {
    $(".UncheckOnLoad input").prop("checked", false);
}

Alternately, if you already have a $(document).ready(function() the you can just add the one line to your existing function.

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

Sign in to reply to this post.