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

Question

Question

Forms lookup problem when source is filled by javascript

asked on March 29, 2018

Hi,

I work with Forms and have limited Javascript abilities and am hoping someone can assist with a challange I'm having.

I'm working on a form that has a text box which is prefilled with a text string where the first two letters are the abbreviation for one of our schools.  I've written a little Javascript that pulls the first two letters and puts it in a "School Abbreviation" box.  

This is the jquery code that fills the "School Abbreviation" box "$('.schoolAbbreviationCss input').val(twoLetter)" 

I've configured a lookup rule to take what is in the "School Abbreviation" box and display the "Full School Name" in another textbox.

The lookup works fine when I manually type an abbreviation but when my javascript fills the School Abbreviation box it doesn't do the lookup.

Thanks in advance for any help.

0 0

Answer

SELECTED ANSWER
replied on March 29, 2018

You may want to trigger a change in the input field after you set its value.

$('.schoolAbbreviationCss input').trigger("change");
2 0
replied on March 29, 2018 Show version history

A nice shorthand approach I use frequently is to trigger the change event in the same chain as the value update.

For example,

$('.schoolAbbreviationCss input').val('new value').change();

I've made a habit of always doing .val('value').change() in my custom javascript since Forms listens for the change to be triggered before executing lookups, field rules, etc.

4 0

Replies

replied on March 29, 2018

Thank you Karina!   Much appreciated!

 

 

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

Sign in to reply to this post.