Custom JavaScript on a form that performs a lookup rule when it loads may need to be updated for Forms 9.2

October 6, 2014 | KB: 1013538
Laserfiche Forms

Summary

In Forms 9.2, if you have custom JavaScript that includes a change event on a field, and the field is automatically populated with a lookup rule, the change event won't occur when a form is initially loaded. Subsequent lookup rules will cause change events, but you will need to handle the 'lookup' custom event if you want to respond to the initial field change.

Resolution

Replace the "change" event subscription with a subscription to both the "lookup" and "change" events.

For example, replace:

$(document).ready(function() {
$('.name input').change(function() {

with

$(document).ready(function() {
$('.name input').on('change lookup', function() {

In this example, '.name input' selects the input elements for each of the fields with the "name" CSS class. You can use any jQuery selector to affect one or more fields.