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

Question

Question

Custom Submit button logic reset when collection changes

asked on June 28, 2022

We have implemented as custom submit button on form so that we can better control when the button appears. The same logic has been implemented on several other processes. However this particular process a "Dependents" collection where users can add names of dependents , as needed. The issue we are running into is that the submit button seems to disappear, although the field rule conditions are met, every time a new row is added to the collection (see below). I originally believed it was due to some J/S we have on the form, but I have tested by removing all of the code and the issue still persists. Looking for a recommendation as to stop , what I believe to be, the reloading of the page without the execution of the field rules. 

Submit showing Prior to clicking ADD

Submit button disappears after clicking "Add"

0 0

Replies

replied on June 28, 2022

The problem is that you're trying to use multi-value objects in a field rule that controls something outside of the collection, so it isn't going to behave the way you're probably expecting.

One solution would be to create a hidden field outside of the collection, use a calculation to check the conditions on all your collection fields, then target that single line in the rule.

For example, if you wanted to hide the button if any of the "dependents" values were blank, you could do something like

=COUNTIF(Collection.Variable,"=")

Then for your Field Rule if you make that a number field, you'd check if that variable was equal to 0 or less than 1 or something.

Or you could make a single line and do something like the following

=(COUNTIF(Collection.Variable,"=") = 0)

And check if it equal "TRUE" or "FALSE"

1 0
replied on June 28, 2022

It sounds like you have Field Rules showing/hiding the button.  Can you share what those field rules show?

0 0
replied on June 28, 2022

We definitely do,  below are the rules.

  • Rule 10 & 12 are the field rules we have for submit.
    • #10 refers to a single line field that is populated by a ID look-up (if a value is found in the repository) or manually entered (if no value is found)
    • #12 refers to a read-only fields that return the same values from the identical look up used in #10 First Last Name
  • We are trying to solve for the instance in which the client does not have a folder in the repository due to being a new customer. 

 

I did verify that you are correct the issue we are seeing is based on two conflicting field rules. And I assume that when we add a new row to the collection the page is reloading and causing the field rules to cancel each other out. Is that what you see happening in this instance? If so have you ever worked through a situation with conflicting conditions? 

0 0
replied on June 28, 2022

There's another issue to address. You should never have two separate rules working on the same field because it will cause unexpected behavior.

When you have two rules, it doesn't combine them and evaluate them together, it will evaluate them in order and the results may be undesirable.

If for some reason you do have a valid reason for two rules, which can happen, the way around that would be to do something like putting it in a section and pointing one rule at the parent section and the other at the element.

As an alternative, you could also use a hidden field, like I described below, that performs the logic check in a calculation, then you can just have one field.

Either of these approaches is the way to get around the lack of "condition groups" such as when you need a combination of ALL and ANY.

0 0
replied on June 28, 2022

I'm remembering your earlier post now about the conflicting rules. 

I think that there is good odds that the two conflicting rules is the cause of the behavior your are seeing now.

It might be worth revisiting those two rules and looking for an alternate option that doesn't necessitate two conflicting rules. 

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

Sign in to reply to this post.