Button as HTML that triggers a rule

Forums Classic DFFS Button as HTML that triggers a rule

Viewing 2 reply threads
  • Author
    • #9690
      David S Kaimann

      I’d like to create a simple “Add note” button that allows the user to enter text into BOX1, then click the “Add note” button and append BOX2 with the new information. I’m thinking the easiest way to do this is create a rule that must be triggered manually; however, I’m not sure how to trigger the rule to run with the ‘onclick’ event for the button. Is this a simple option – or – a more complex custom JS that must be built?

    • #9693
      Keith Hudson

      David; you can trigger a rule from a button like this:

      <button type="button" onclick="spjs.dffs.triggerRule(['Append']);">Test</button>

      My ‘Append’ rule sets the value of Box_1 to “{Box_1} {Box_2}”.

      So, when Box_1 = “One fish” and Box_2 = “Two fish”, after pressing the button on my form, Box_2 = “One fish Two fish”.

      If you want to insert a line break when appending, your rule would look like this: {Box_1}\n{Box_2}

      Based on my testing, that will work for either plain text OR enhanced rich text fields.

      NOTE 1: DFFS is incompatible with Rich text fields, as far as I know.
      NOTE 2: I tested using the Dec 14, 2015 version of DFFS.

    • #9703
      David S Kaimann

      Thank you! Works like a charm!

Viewing 2 reply threads
  • You must be logged in to reply to this topic.