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

Question

Question

Javascript is setting field value then lookup rule not working

asked on July 20, 2017

Hi,

In Forms 10.2 I'm using javascript to set the value of a field, then I'm trying to use that field as a condition to populate a dropdown list, but it's not working.

If I change the the field value manually, even to the same value that the JS is providing, the lookup is successful.

Anyone know of a way to get the lookup rule to"see" that the JS has set a value?

 

0 0

Answer

SELECTED ANSWER
replied on July 20, 2017 Show version history

When you set the value, you need to trigger a change event, which in turn triggers the lookup.

For example,

$('#q1 input').val('test').change();

Adding the .change() at the end of where you set the value should solve your problem.

As a side note, if you don't trigger the change event, you might lose the data after the form is submitted. I had this problem in the past, not sure if 10.2 changed that, but I've made a habit of triggering the change anyway to avoid problems with lookups, field rules, etc.

1 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.