Implement a Star Rating Custom Form Element using a Third Party Library
Implementing a custom form element allows you to augment the existing form elements that come with Geocortex Workflow.
This article will walk you through creating a form element that uses the react-star-ratings component to allow the user to select up to five stars.

#
PrerequisitesFollow the instructions in the Web Applications SDK page to set up your development environment.
note
A working knowledge of TypeScript is recommended before extending Workflow for web-based hosts.
#
OverviewImplementing a star rating custom form element for web applications using a third party library consists of the following steps:
- Adding third party library dependencies to your project.
- Creating the custom form element.
- Implementing the custom form element using the third party library.
#
Adding Dependencies- Run
npm install react-star-ratings
in the terminal to install the third party react-star-ratings component.
#
Set up Custom Form Element SkeletonTo create a new form element:
- Open the Workflow activity SDK in Visual Studio Code.
- Run
npm run generate
in the terminal. - When prompted, select
Form Element
. - Enter the name of the form element you would like to create and press
Enter
. For example,StarRating
. - Open the newly created
src/activities/StarRating.tsx
file.
#
Implement the Custom Form ElementModify the skeleton form element implementation in src/activities/StarRating.tsx
to match the following example.
#
Deploy the Form ElementFollow the instructions to build and deploy the activity pack.
#
Test the Form ElementOnce your activity pack is hosted and registered, your Register StarRating Form Element
custom activity should appear in the activity toolbox in Geocortex Workflow Designer alongside the built-in activities.
To use your custom form element in a workflow:
- Add your
Register StarRating Form Element
custom activity to your workflow so that it runs before anyDisplay Form
activities that will use the custom form element. - Select the
Display Form
activity that you want to include your form element in. - Add a
Custom
form element to the form. - Set the
Custom Type
property of theCustom
form element toStarRating
. - Test your workflow.