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

Discussion

Discussion

Features Suggestion - Lookup Table Insert Query Rule - Require population of fields on form before calling rule

posted on September 9 Show version history

I noticed that if I add a Lookup Rule to a form that is an insert rule without a Show auto fill button, the rule just runs over and over again continuously even when the user has not populated the fields yet. So you end up with just a bunch of blank values when someone visits your form.

For insert rules, it would be nice to have an option that the field must have a value and only when the value changes should the rule be run again.

I can enable the auto fill button, hide it, and use javascript to press it when any field changes and all have values but I am looking for a non-scripted way to do this to make it easier.

0 0
replied on September 9

I have had similar issues designing forms that edit tables/apis in real time on the form. Could you describe a little more of the use case? Generally insert/update queries happen behind the scenes in either the process diagram or workflow.

We are looking into better ways to handle "field rule like lookup rules" so outlining what you are trying to accomplish will help us meet that goal

For now, form only use cases don't need to script the clicking of the autofill button (which you can't anyway), but instead return cancelLookup from onLookupTrigger when fields don't meet your validation requirements.
https://doc.laserfiche.com/laserfiche/en-us/Content/Resources/BusinessProcesses/Javascript-and-CSS/TheLFFormObject.htm?Highlight=lfform#onLookupTrigger

0 0
replied on September 9

In this case for an internal non-public form that includes select lookup rules, I want to capture the logged in user, current location, and the select field value they use to lookup information so that I have a recent history record.

We can use this data for quick menu items of recently viewed accounts and instant alerts on unusual locations.

I suppose the form is a little less common as sometimes it is just used to lookup data and the submit button is only used when a process needs to be started.

I am on the classic designer on this one, but this is a useful function for the LFForm object that does the same thing. Was just looking for a checkbox on the rule next to the input field saying this field must have a value.

0 0
replied on September 9

Hu that is a neat implementation. It isn't common to have "usage tracking" like that in a form, but for your case that does make sense.

We will not be touching lookup rules in classic forms so you'll be stuck with current behavior there. You might still be able to cancel the lookup event like I noted for the LFForm event, but with the actual DOM event in classic. I haven't played with that in a while though.

Like I said earlier we do want to enable this type of interactions in the form designer so I've noted your feedback!

1 0
replied on September 10

I was surprised to find that even Autofill does not do what I thought. The rule still runs automatically when the user visits the form 1 time, just not continuously. But I thought enabling autofill would wait for the user to click the button before the rule runs. Every time I visit the form I get another blank row in the table.

0 0
replied on September 11

That may be a bug, I can reproduce it in classic but not the form designer. I'll see if the team has bandwidth to fix it, but it would be a low priority.

Does the scripting approach work at all?

0 0
replied on September 12

My script works in the sense that it presses the autofill button when the data is populated and/or changed but it can not stop the initial execution that runs when the form loads which inserts a blank row. I guess I need to call another delete function that deletes blank rows at the same time with a new rule.

0 0
replied on September 12

What happens if your database has constraints that don't allow insertion of blank rules?

0 0
replied on September 12

In the rule I don't have an option to set inputs as required and in lookup tables I do not have an option to disallow null in any columns. There is no real way to require a value for columns like there is in Microsoft SQL.

0 0
replied on September 12

Oh ya, sorry forgot you were on cloud. I created a bug, will check to see if its an easy fix or not #613939

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

Sign in to reply to this post.