1
0
-1

Hi,

I am curious if there is a way of having an event fire if a field value changes dynamically. The change rule on a field seems to only trigger after focus has left the field AND a change has happened.

My use case revolves around the Google Address widget. When a user inputs their address, the address fields auto populate. I need to fire a rule when the zipcode field is dynamically populated to check data in the field.

Are there any events or methods to trigger a rule when a field is dynamically populated like the use case above?

 

Thanks!

Lance

    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      Hi Lance,

      You can fire the rule after you change the value like this:

      Form.fireRule("change", "zipCode", data);

      The first parameter is the rule type.

      The second is the id string or item object of the field that has the rule.

      The third is the data context object. This should make the data context of the field that has the rule. For example if the rule you are calling this from is within a repeat and the address lookup is outside the repeat. It would look like this:

      Form.fireRule("change", "zipCode", data.$p);


      You can also right click the zip code in the code editor tree and click change


      Cheers,

      David

        CommentAdd your comment...