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

Question

Question

Show Field(s) if Multiple Records Returned From Database Lookup?

asked on December 4, 2014

We have an HR form that is filled out for employees when their positions, hours, pay, etc. changes. The form auto-populates information about the person filling out the form as well by performing a database lookup based on the employee's email address into our HR software to return who their supervisor is. The fields that get populated are hidden with the following CSS:

.dontshow {display: none;}

The problem we have run into is that some employees have multiple positions and therefor multiple supervisors. When this happens, the supervisor information is not filled in correctly because it wants someone to select one of the multiple values returned for those fields. Is there any way when a lookup returns more than one value for a field to have it change the CSS display value so it will show those fields so someone can select from the available values?

1 0

Answer

SELECTED ANSWER
replied on December 4, 2014 Show version history

You can check whether the value for the supervisor is empty or not to decide to show it or not, I wait for 1 second for lookup may take some time, you can adjust the wait time.

 $('.email input').change(function(){
   setTimeout(function() {
    if ($('.supervisor input').val()==""){
    $('.supervisor').show();
    }
  }, 1000);  
 });

 

0 0

Replies

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

Sign in to reply to this post.