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

Discussion

Discussion

Forms 11 - When 'Ignore hidden fields' Field Rules get... ignored

posted on August 24, 2022 Show version history

UPDATED:
After discussion and consideration, the existing rules make sense.  If a field is hidden during a process, with the 'ignore' rule set, the system discards any changes and preserves the pre-hide-rule value.  That value may be blank, or have something from a previous non-hidden submission.  

If you need or expect a field to be cleared once hidden, the method below can still be helpful to you.

 

ORIGINAL POST:
I don't know if anyone else has been noticing or otherwise being affected by it, but I thought I'd share my experience.  I've found on our current version of Forms (Professional Version 11.0.2201.20436) that if a field hidden by field rules gets populated in one submission, then re-hidden in another, the value that was previously saved is still retained.  This causes some havoc for some aspects of our process. 

I have passed this along to my VAR, and they passed it along to Laserfiche, but I spent some time today building a javascript workaround and decided to share in case anyone else needed it.

 

By way of exposition, here are a few details that might help clarify this code:

  • This function will run under any Submission action (Submit, Approve, Reject, or custom if you're using the same type of buttons). 
  • To ensure the code ran only where I wanted it, I had to go through and find all of the fields that were hidden conditionally (that I did NOT want to save the values of), then I added a class called 'conditionalHide' to each one.
  • I have some true/false questions in the Form that I wanted to save the default 'false' (value = 0 for database purposes) if the field was hidden, so there's an bit of code for that.

 

Hopefully, with that bit of explanation, the rest of the code makes sense to you.

$(document).ready(function () {
  //Disable Autocomplete
  $('input').attr('autocomplete','off');
  
  // Forms 11 is failing to follow the 'ignore field values' rule; clear hidden fields upon submission
  $('form input[type="Submit"]').on('click', function () {
    $('.conditionalHide').each(function(){
      // See if the current element is hidden
      var isHidden = $(this).is(':hidden');
      
      // if it is hidden,
      if (isHidden){
        // See if the current element is a radio or checklist field
        var isRadioOrCheck = $(this).find('span.choice').length > 0;
        // Find the 'false' element for true/false radio buttons
        var $falseValue = $(this).find('span.choice input[value="0"]');

        // if it is a radio button field, clear any and all selections
        if(isRadioOrCheck){
          $(this).find('span.choice input').prop('checked',false);
          // for my fields where I want the default 'false' value, re-check that value
          if ($falseValue.length > 0)
            $falseValue.prop('checked',true);
        }
        // for everything else, just set the value to empty
        else{
          $(this).find('input').val('').change();
          $(this).find('select').val('').change();
          $(this).find('textarea').val('').change();
        }
      }
	});
    // Finally, return 'true' to move Forms along with Submission
    return true;
  });
  
});

 

2 0
replied on October 11, 2022

This should be a bug for field rule. We will look into fix it.

1 0
replied on July 30

We're seeing this issue in 2024. Was a bug report ever created? Has any attempt to patch it been made? Is it still being actively investigated?
 

0 0
replied on July 31

Hi Michael,

This is regarded as expected behavior even in latest Forms release for now, see the Notes section from here https://doc.laserfiche.com/laserfiche.documentation/11/administration/en-us/Default.htm#../Subsystems/Forms/Content/Rules.htm?TocPath=Forms%257CCreating%2520a%2520Form%257C_____5. But we do have a bug filed for this, id is 403080. The explanation for current behavior is same as @Jason Smith illustrated below. 

1 0
replied on July 31

Thanks for the update.

0 0
replied on August 26, 2022

My opinion is that Laserfiche changed a lot of the mechanics of Forms with the Forms 11 release which is taking many of us by surprise because it changes much of the functionality that we understood and relied on since Version 9 about how Forms functionality behaved.  The problem is that it hasn't been communicated well so we can adapt.  In our case we've been told that a Forms function always worked this way when we have another environment running Forms 10.4.5 and can demonstrate it is not true and that it changed in Forms 11.

0 0
replied on August 25, 2022

This is interesting; thanks for posting, Sean!  I have run into some similar issues.  One that I can think of is:

A hidden field for "current user" that is used for assignments.  I can't remember exactly, but that field was not changing when the next user opened the form and so the next assignments got sent to the wrong users.  I had to give up that way of setting assignments.  

Here's another explanation of a similar issue I had:  A person is assigned to add accts payable GL codes to payment requests.  Then the approver gets assigned and something is wrong so he wants to "Send Back" to the previous person to get it corrected before he/she approves the request.  The Send Back was not always picking up the right name.  It was retaining the name of a person from a step even further back.  I had to find ways around this one too.

1 0
replied on August 24, 2022

I did some tests and it's not exactly that the field is being saved, it's that "ignore" is being treated like "no change" rather than blank so it won't wipe values from previous submissions.

As a result, once a value is submitted, even if the field is hidden/ignored in a subsequent task it does not treat that as an update and holds onto the the previous value.

I created a simple form with a single line field shown/hidden based on a checkbox, set it to ignore the value when hidden, and saw the following (each numbered step is a submission).

  1. Starting Form: entered "Test" in Field 1 and set field as Shown - Submit
  2. User Task: changed field to Hidden - Submit
  3. User Task: changed field to Shown and "Test" still present - Submit
  4. User Task: emptied the field and set it back to Hidden - Submit
  5. User Task: changed field to Shown and "Test" is still present 

 

  1. Starting Form: entered "Test" in Field 1 then changed to Hidden - Submit
  2. User Task: changed field to Shown, value is blank

 

I'd say this is undesirable because it leaves us without a way to "reset" a field apart from JavaScript or Workflow solutions that essentially have to check the same field rule conditions.

2 0
replied on August 25, 2022 Show version history

Thanks for clarifying Jason!  You are correct regarding the need for previous submission; I'm updating my posting accordingly.  I also took a screenshot of a modified Leave Request Form wherein I changed my Leave Type.  I have some fields I added that were only visible (and otherwise ignored) for Sick Leave, so when I changed the Leave Type on a subsequent submission those Sick Leave values should have been ignored.

 

Leave Request Change.png
0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.