How to require that certain fields be filled in befow submitting the form.

  • 24 February 2022
  • 0 replies

Userlevel 5
Badge +20

How to require that certain fields be filled in before submitting the form.


K2 blackpearl
This article was created in response to a support issue logged with K2. The content may include typographical errors and may be revised at any time without notice. This article is not considered official documentation for K2 software and is provided "as is" with no warranties.


This can be done in a number of ways. I'm going to highlight two of them. 1) Create Conditional Rules to show the a message to the user if all the fields are not filled it when the Submit button is clicked rather than submit the form. 2) Require certain fields in order for the SmartObject method (Create, Save/Update, Delete, Read) to be able to be executed.

Before You Begin

Make sure you have access to K2 Designer and the list/library (if using SharePoint) the solution was created off. Reviewing the SmartForms Builder Tutorial ( may be useful too.

How-to Steps

For the 1st method:

1) Go into the When Submit Button is clicked rule which will submit the form and data.

2) Drag the 'a control contains a value' condition to after the When 'Submit' Button is Clicked. Target the control you want to require.

3) Keep dragging the conditionals for each Control you want to require.

4) After the conditions, add SmartObject method rule (e.g. 'then execute the Create List Item method' for the New form/view). This will have it fire only if the conditions are passed.

5) At the bottom, after the SmartObject method and outside of the conditional check, add a Else condition. Then add a 'Show a Message' and configure it to tell the user that they are missing some of the required fields. This will fire if the conditions are not met.


For the 2nd Method:

1) [If using SharePoint] Go into the List Setting of the list that the SmartObject will be created from. Add the columns, but make sure to select the YES radio button under 'Require that this column contains information'. If the columns are already added, select each one (which will open the Settings page for the column) and select the radio button YES to require the column contains information.

2) Go back to the list page, select List tab at the top and select Application. This will take you to the artifact page. If this is the first time doing this, go through the Create New process. If you edited the columns, select Regenerate SmartObjects in the artifact page to regenerate the SmartObjects with the new required columns.



3) [If NOT using SharePoint] Go into K2 Designer and open the SmartObject that has the fields you wish to require.

4) Under 'Define Properties & Methods' check the Required checkbox next to each field.

5) This will cause the required fields to contain a value in order for the SmartObject to be able to execute any of its methods (Create, Save/Update, Read, Delete) but not necessary restrict the SmartForms from being submitted (if the SmartForm doesn't contain any SmartObject methods).

0 replies

Be the first to reply!