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

Question

Question

concatenate after lookup fields populate

asked on March 28, 2018 Show version history

I can see when the event is triggered, but I cannot get the values of the fields and concatenate them:

/*concatenate escalated user name*/
  $('#Field349').on('change', function(){
    $('.Escalated_Approver_Name input').val($('.escalateLName input').val()+", "+$('.escalateFName input').val());
        
	});

 

0 0

Replies

replied on March 28, 2018 Show version history

Chris,

You can attempt this JavaScript function. This will check to see if either value is filled. If both values are filled then it will concatenate them. If not it will leave the field blank. There are two function calls to trigger based on either field when changed. 

$(document).ready(function(){
/*concatenate escalated user name*/
  $('.escalateLName').on('blur', 'input', EscalatedApprover);
  $('.escalateFName').on('blur', 'input', EscalatedApprover);
  
  function EscalatedApprover(){
    if(($('.escalateLName input').val() != "")&&($('.escalateFName input').val() != "")){
    $('.Escalated_Approver_Name input').val($('.escalateLName input').val()+", "+$('.escalateFName input').val());
    }
    }
  
});

 

1 0
replied on March 28, 2018 Show version history

thanks for the code. Since the field is being populated by a lookup, it is not registering the blur event. Was it working for you with a lookup?

Thanks

0 0
replied on March 28, 2018

I got it to work using the FieldXXX ID:

/*concatenate escalated user name*/
  $('#Field349, #Field350').on('change', function(){

    if(($('.escalateLName input').val() != "")&&($('.escalateFName input').val() != "")){
    $('.Escalated_Approver_Name input').val($('#Field349').val()+", "+$('#Field350').val());
    }

  })

for some reason it did not like the classes as a selector..... I have seen this before, not sure why it gets picky about the selector type sometimes.

Thanks for the help!

1 0
replied on March 28, 2018 Show version history

Chris,

The issue is that there is a delay with the look up hence you would still get undefined. I was able to use the css selectors and base it on the look up with the drop down. Either way works though yours is shorter due to looking at the change for the fields that are filled out rather than the drop down.

$(document).ready(function(){
  
    var timerS;
    $('#Field349').on('change', function(){

    clearTimeout(timerS);
    timerS = setTimeout(function(){
    if(($('.escalateLName input').val() != "")&&($('.escalateFName input').val() != "")){
    $('.Escalated_Approver_Name input').val($('.escalateLName input').val()+", "+$('.escalateFName input').val());
    }
    },1000);
  });
});

 

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

Sign in to reply to this post.