Can you call an Initialized() method from a SmartForm while it’s Initializing? (Sponsorship opportunity for Excedrin or Tylenol)

I’m going through the rules in a SmartForm and associated views to squash a bug, when I came upon an Execute a Form method action in the When the Form is Initializing rule.

Trouble is, the method to call is the Initialized method.

Would that even work?

Would calling the Initialized() method from within the When the Form is Initializing() rule work? Because at the point where you’re calling it, the form is still initializing!

Welp, it turns out it actually will work.

Here’s how to test:

  1. Create a new SmartForm and add a single DataLabel to its canvas.

  2. Create a When the Form is Initializing rule.

  3. In the Rule Designer, add two Transfer data actions.

    Format the first Transfer data call to put the current value of Data Label into the Data Label, followed by a space and the word “Initializing()”.

    Do the same for the second Transfer data call, except the words are “Return to Initializing().”

  4. Create a When the Form is Initialized rule.

  5. In the Rule Designer, add a Transfer data action that follows the same format as the others, but with the word “Initialized()”.

  6. Finally, open the When the Form is Initializing rule again, and insert a new Execute a Form method action between the two Transfer data actions. Point the call at the Initialized() method.

  7. Close the Rule Designer, click the Finish button, and then browse the form using either the testing URL or the runtime URL.

  8. You should see this text appear on the form:

    Initializing() Initialized() Return to Initializing() Initialized()

    The Initializing() method was called first, followed by the call to the Initialized() method that we inserted, followed by a return to the Initializing() method; once completed, the Initialized() method was called as normal.

    How about that?

    Excedrin® is a registered trademark of the GSK group of companies. TYLENOL® is a registered trademark of Johnson & Johnson Consumer Inc. And no, I wasn’t actually seeking sponsorship of any kind.

Can you call an Initialized() method from a SmartForm while it’s Initializing? (Sponsorship opportunity for Excedrin or Tylenol)

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s