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

Question

Question

Forms is autofilling when Field is hidden

asked on March 9, 2021

Hello everyone,

 

I have a form that is doing a lookup based on vendor ID matching. If the ID matches it fills in a dropdown that contains a variable for another lookup. The dropdown that gets populated is hidden until the user checks a box to show that dropdown. My issue is that even though the dropdown is hidden, my table is auto populating the results even though the user didn't say to by checking the box. Is there a way to force the BLANK option in a dropdown to stay even when doing a lookup that only contains 1 item from SQL?

 

Ideally, I only want the table to populate when the checkbox for "Use a GL Template" and a template is chosen, but since that dropdown gets populated with only 1 result, LF wants to just populate the data ahead of time.

 

Attached some screens to help assist.

Issue screenshot.PNG
Field Rules.PNG
Lookup Rules.PNG
Dropdown filled from SQL screenshot.PNG
Field Rules.PNG (43.08 KB)
Lookup Rules.PNG (92.21 KB)
0 0

Replies

replied on March 12, 2021

Found a possible option.

We can force it to have at least 2 values so that it doesn't auto-select an option.  Then after the lookup processes we can delete those extra 2 values.

Try this.  Give your dropdown a CSS Class Name of myDropdown.  Give it these two choices: DELETE-ME1, and DELETE-ME2.  And mark the checkbox to Append choices to lookup results.  Set-up your lookup that will populate a single value into the drop-down field.  Then add this Javascript to the form: 

$(document).on('onloadlookupfinished', function(event) {
  
  $('.myDropdown option:contains("DELETE-ME1")').remove();
  $('.myDropdown option:contains("DELETE-ME2")').remove();
  
});

 

This waits until the looksups are completed that happen upon form load, then it deletes the two placeholder values.  I tested this with a lookup that only returns a single value, and confirmed that it was not auto-selecting the single value in the drop-down field.

Hope this helps!

1 0
replied on March 9, 2021

It's not elegant, but you could prepopulate a value into the dropdown (like a single space) and mark the option to have the lookup results append to the values added in the Layout page.  That way, if the lookup populates 1 value, you actually have 2, the one populated and the space option you listed.

0 0
replied on March 9, 2021

That was my first thought, sadly it did not work.

0 0
replied on March 9, 2021

Oh, bummer.  I thought I'd done that before, but maybe not.

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

Sign in to reply to this post.