K2

How to display dynamic HTML Web Content in K2 SmartForms

With the K2 Workflow process, we have found that a large percentage of clients at some point request to have a visual representation of the Workflow within their application. By using a combination of K2 SmartForm features we can accomplish this.

HTML Web Content in K2 SmartForms

K2 SmartForms – Dynamic Web Content – 1

The main focus of this topic is the K2 SmartForms Content Control. This control allows you to specify a URL and display the web content of the specified URL within your own page.

K2 SmartForms - Dynamic Web Content - 2

K2 SmartForms – Dynamic Web Content – 2

Once you have added the Content control to your view, you can either specify a static URL / placeholder URL, show a preview (only if you provided a static URL) and change the scrolling settings.

K2 SmartForms - Dynamic Web Content - 3

K2 SmartForms – Dynamic Web Content – 3

For this example we need to display a dynamic URL based on the K2 ID for each specific workflow. To do this we use a combination of K2 SmartForm rules and expressions. We set the dynamic URL on view initialise to demonstrate this.

K2 SmartForms - Dynamic Web Content - 4

K2 SmartForms – Dynamic Web Content – 4

When you configure the rule we just added you will see that you have access to all the view parameters, K2 SmartObjects, view controls as well as existing expressions. The dynamic URL used here comes from an expression we created that concatenates the K2 Workflow URL with the K2 ID in order to display a specific workflow based on parameters sent through upon view initialisation.

For more information on using K2 expressions view some of our previous blogs on the topic:

Using a K2 SmartForm expression as a SmartObject input parameter;

How to set a “Welcome back, User’s Name” on a SmartForm App’s Header

Or, if you need a different approach have a look at:

Displaying a hyperlink column in a K2 SmartForms ListView

HTML Web Content in K2 SmartForms

You may also like

Leave a comment

PODCAST  |  Why you need to establish a K2 Center of Excellence today

Interview with Arno van Rooyen, CEO, Velocity