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

Question

Question

Use 15 digit lookup number field to make last 5 digit number

asked on November 6, 2015 Show version history

I have a form that I do a lookup in a SQL database on and get a 15 digit number with a class of .acct  I would like to make another field, with the class of .ext and have it populate with the last 5 digits of that number so I can use the field .ext when saving the form to the repository.  I believe it can be done with JavaScript but I am not versed enough in JavaScript to figure it out.

 

1 0

Answer

SELECTED ANSWER
replied on November 6, 2015

You can use JavaScript like below

$(document).ready(function() {
  $('.acct input').on('change lookup', function() {
    $('.ext input').val($(this).val().substr($(this).val().length - 5));
  });
});
1 0
replied on November 6, 2015

Thank you so very much!!

Worked like a charm. 

0 0
replied on November 8, 2015

What is the "change lookup" event? Is it a custom event in Forms?

0 0
replied on November 8, 2015

See KB 1013538. It's to handle the scenario if the lookup was done automatically during initial form load.

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.