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

Question

Question

Javascript Assistance Needed

asked on January 19, 2021

Back again you all,

So I have a lookup rule that is filling in a single line with possible choices for "fuel type". I am using the single line versus the drop-down (What I would prefer and usually use) due to the granular level I need to go when setting up field rules for the form. From what I can tell Laserfiche will not allow me to setup the field rules in the drop-down unless I have included the options in the actual configuration. And I do not want to do that because then my lookup rules are jumbled in with the already existing list. 

(Ex. drop down list contains A,B,C,D but based on my lookup rules I only want A&D as options.  From my testing A&D may be at the head of the list but the other lookup excluded options will still display in my drop-down) *Please correct me here if I am wrong and I will be ecstatic

Due to this issue and I trying to get this JS code to work that a colleague of mine and a fellow Laserfiche Answer'er provided. For some reason I am not getting the behavior I want after I save even though no errors appear 

Here is the code I am inserting: 

  var fueltype_Reduced_arr = ['HEV Diesel -- Diesel Hybrid Electric Vehicle','HEV Gasoline – Gasoline Hybrid Electric Vehicle'];                  
  if ($.inArray($('#q654'), fueltype_Reduced_arr) > -1){
      $('#q651').attr('hidden','false');
    }

I used the "false" because I want the field to show if the input is included in this array, otherwise I want the field to remain hidden.  Should I use a field rule to automatically hide the field always and let this code override. Also this code is a snippet of my larger code sheet and yes it is within a "$(document).ready(Function()"

 

For kickers here is the field rule I had in place prior that worked, but the end users didn't like the single line displaying all their options because they had to clear the line to see the other options. 

 

Thanks in advance, you all are awesome!!

0 0

Replies

replied on January 19, 2021

Hi Lawrence, 

Ex. drop down list contains A,B,C,D but based on my lookup rules I only want A&D as options.  From my testing A&D may be at the head of the list but the other lookup excluded options will still display in my drop-down

For the issue with drop-down field and lookup rule, have you checked option 'Append choices to lookup results' in the drop-down field? Since if I unchecked it (which is also the default setting), drop-down field only shows options returned by lookup rule.

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

Sign in to reply to this post.