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

Discussion

Discussion

Prevent dropdown from auto populating after lookup

posted on May 25, 2017

We've created a fairly complex form that does a lot of lookups on the page, each of them use multiple criteria so we end up with lots of Autofill buttons.  we've gone in and created Javascript functions that when dropdown field is changed we click the autofill button.   The issue we run into is when Forms does it's lookups and there's only one value returned it will automatically select that option in the dropdown, normally this is preferred but in this case Forms might run 4, 5, 6 lookups and when Forms autoselects the dropdown options it triggers more lookups and we're running into lots of timing issues where the Forms lookups will almost get ahead of itself and clear out random fields or skip lookups entirely..  but we don't seem to have issues when we are forced to click the autofills.  

So my question in all this is can we make forms not auto select a dropdown value when it's the only lookup result?  any backend file with a setting that says to auto populate or anything like that would be very helpful.  Otherwise we're stuck having to reconcile the speed at which Forms does lookups and autofills with the time it takes javascript to trigger

0 0
replied on June 13, 2017

Hi Brandon,

You can update Forms file for lookup to update the logic. Please be careful that this would affect all processes in this Forms server.

Find this file: c:\Program Files\Laserfiche\Laserfiche Forms\Forms\js\form\lookup.js

Find content:

if(sel){options+='<option selected="selected">';foundItem=true;}

And replace it with:

if(sel){options+='<option>';foundItem=true;}

After that, press Ctrl+F5 on your browser to refresh cache.

0 0
replied on November 7, 2023

Hello,

I'm having the same issue running in V11

I've found 3 places in the lookup.js file that refer to <option selected="selected">, but none of those are quite like what you show above.

Perhaps that code has changed a bit?

 

 

 

0 0
replied on November 7, 2023

Hi Velma,

 

Yes, the code you are looking for is updated for fixing some lookup bug, now it looks like:

									if (sel) {
										foundItem = true;
									}
									options += '<option ' + (sel ? 'selected="selected" ' : '') +
										(v < optionList.length ? 'lookupOptions="true" ' : '') +
										(existingOptions.indexOf(mergedOptions[v]) > -1 ? 'lookupAddRows="true" ' : '') +
										'value="' + $.escapeHtml(mergedOptions[v]) + '">' + mergedOptions[v] + '</option>';

I cannot give you instructions how to update this part, as the logic becomes more complicated than that time, and a small change can break the whole function. It seems you encounter some performance issue with lookup rule, could you open a support case directly for your question and link to this answers post?

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

Sign in to reply to this post.