Feature Peek 2011: PrimalForms – Form Templates

PrimalForms 2011 will ship with a number of predefined templates that will make things easier for you when creating a GUI for PowerShell.

Select Form Template

(Fig 1: When you create a new form, a list of templates will appear.)


We know some of you will want to create your own reusable templates, so we implemented  any easy way for you to convert your forms:

Create Template Menu Option

(Fig 2: Create Form Template Menu Option)

I want to the option to search the my exported database queries, but the default query form doesn’t support the functionality. So I start by creating a Form with the “Grid Template” and I add a text box and button labeled “Search”. I create a function to handle the search using the text from the text box. This function will be called when the “Search” button is pressed.

Seach Function

Next I add a special token, so that I can determine where the Grid Query Function will be called and placed. In this case, I want the query function to be called when I press the “Query” button.

Query Function Token

Once I am satisfied with my form, I press the “Create Form Template” button and the following dialog appears:

Create Form Template Dialog

(Fig 3:  Create Form Template Dialog with Thumbnail of Form Template)

A thumbnail of the form is displayed along with a few required fields. I name my template and select “Grid Template” as the type. I need to select the “Grid Template” type so that my new template is used for exporting for WMI and Database Query Forms. Otherwise if I select “Form Template” it will be used as a template for normal Forms. Next I provide a short description of the template which will be displayed with the template. Finally I press the “Save” button and I’m done.

Next time I export a Query Form, the new template will appear as an option.

Select New Template

(Fig 4: New Template is displayed when Exporting a Query Form)