1
0
-1

Im trying to create a function that can be triggered from different event on a custom component (ie. trigger the same function on the click event on two different buttons). I think that i can do that using component rule templates but i can't find any documentation on how they work.

    CommentAdd your comment...

    2 answers

    1.  
      1
      0
      -1

      We have many business rules stating that we have to end the user's session (ie. if there's a service error, you must end the session, but we also have to end the session if there's 2 minutes of inactivity), so i would like to have the code in a "session component" inside the template so the form developers can call it with something like 

      Form.fireRule('endSession', item, data)
        CommentAdd your comment...
      1.  
        1
        0
        -1

        Hi Ben

        In order to answer you question accurately, it would be very helpful to understand better exactly what you are trying to do. The answer will differ depending on exactly what you are trying to achieve.

        However, here are some possible suggestions:

        1. You could write the function in a JavaScript file, and simply call it from the component. That has two disadvantages.
          1. The JavaScript file is not included in the component itself.
          2. External JS files do not automatically get refactored if you change the field. So they can break more easily than JS that exist on field events.
        2. You could set the value of a data field (from both clicks), and then have the code on a calculation event on that field.
        3. There are other techniques depending on exactly what you would like to do.

        I'm personally have not heard about "component rule templates" - can you give me a reference to where you found information on this.

        Thanks,

        Howard

          CommentAdd your comment...