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

Question

Question

Do Lookup Rules use a field's value?

asked on October 30, 2015 Show version history

Background: I need to transfer a person's first and last name values from one set of fields to a set of hidden fields, which are used for a database lookup. Depending on a dropdown choice, the names are pulled from the corresponding fields into these hidden fields. Since Lookup Rules don't have this sort of logic built-in, I've determined this may be the best way to handle it.

I'm copying the values using the jQuery val() function. This works fine, until I try to run a database lookup on the hidden fields. The lookup fails to find any results. If I choose the original text field from where the text originates, the lookup runs just fine. 

See the code below which copies the original values into the hidden field's input then runs the database autofill function. The text is copied just fine, and the lookup runs fine if the other text fields are chosen as the lookup rules.

Why is the lookup rule successful if I run it on the original fields, but not on the fields where the values were copied?  

var relationSelected = $('.relation').find(":selected").text(); //get the relation type
  
  //determine if the employee is claiming on their own behalf, or a spouse/dependent
 if(relationSelected == 'Employee')
    {
     	$('.lookupFirstName input').val($('.employeeFirstName input').val()); 
      	$('.lookupLastName input').val($('.employeeLastName input').val());
    }
  else
    {
     	$('.lookupFirstName input').val($('.claimantFirstName input').val()); 
      	$('.lookupLastName input').val($('.claimantLastName input').val());
    }
  
  //run the DB lookup  
  autofill();

 

0 0

Answer

SELECTED ANSWER
replied on November 16, 2015

Thank you for the help! I was triggering the event using a button, which was working fine aside from the lookup. I did however discover that the lookup did not work if the field was read-only. Once I removed the read-only attribute, it worked just fine.

0 0

Replies

replied on October 31, 2015

Try putting a ".change()" at the end of the statements. That should trigger a lookup.

If that doesn't work, keep the ".change()" at the end of the statements, but also change the "vo" attribute for all fields the lookup populates to "e". See this previous post. According to that post, Laserfiche said that if the fields populated by the lookup were previously filled in, you need to change the "vo" attribute on those fields to "e" , i.e. $('.fields_being_populated').attr('vo', 'e'). I'm not sure what "vo" stands for, but the "e" may stand for "electronic", as the fields I've looked at are set to "u", which I assumes means "user". (I could be completely wrong about that, but it's how I've remembered it.)

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

Sign in to reply to this post.