DFFS form loaded event -> Is there on to listen to?

Home Forums Classic DFFS DFFS form loaded event -> Is there on to listen to?

Viewing 1 reply thread
  • Author
    Posts
    • #8465
      nils.enhoerning
      Participant

        Hi,

        I am writing a lot of JavaScript, often interacting with the dffs forms when I have a requirement that the rules functions cannot handle yet. Sometimes these requests involve running queries on form load to see if, for instance, an item exists for the current user and this category (where category is a choice field or a lookup). To then read the value I use something like

        $(“select[title~=’Category’] option:selected”).text();

        The problem is that if I use document $(document).ready(function(){//code here}); it will fire before DFFS has prepared all the columns, or in parallel to it. And I prefer not to use a timeout to resolve this 🙂

        To trigger this reliably it would be great if there is an equivalent to $(document).ready but something along the lines of $(dffs).ready 🙂

        Is there such an event being fired when the form is loaded that I can tap into from javascript? As there is a form rule for it I suspect there is some status I can use.

      • #8466
        Alexander Bautz
        Keymaster

          Hi,
          You find a trigger named “The form is ready” in the rule, and this can call your custom function in the “Run these functions / trigger these rules” field.

          If you use an older version and cannot find this trigger, you can wrap your function call in this function:

          function dffs_Ready(){
              // add your code here
          }

          Hope this helps.

          Alexander

      Viewing 1 reply thread
      • You must be logged in to reply to this topic.