Skip to content

Workflow Suggestbox field

This is an implementation of the typical AJAX suggest box component:

Attribute Description Required
label The text shown as a label in the user interface. true
name Unique field identifier.
Two fields cannot have the same name in the same task definition. The name must be unique.
true
value Specifies a default value for this component. false
width The width of the HTML element.
In the case of KCenter, the UI must use percentage-based width values; for example:
- width=“50%” will work
- width=“100px” will be ignored in the KCenter UI.
false
description General description. false
filterQuery A SQL query to filter suggestions. Use {0} as a placeholder for the user’s input. *
valueQuery A SQL query to retrieve the display value for a given identifier. Use {0} as a placeholder for the identifier. *
className A Java class used to retrieve suggest box values. *
filterMinLen The minimum number of characters in the input required to begin filtering results. Default is 3. false
dialogTitle The title of the HTML dialog. true
data When present, an identifier that is used to dynamically load the value. false
visible This attribute only makes sense when used in conjunction with an object mapped in the data attribute; the visible value of the object mapped in data is assigned to the form field, causing it to be shown or hidden (the most common use is to hide it). The default value of visible is true. false
readonly When true, the field cannot be modified. Default is false. false
  • * There are two mutually exclusive ways to source suggest box values (one is mandatory):

  • Child elements:

filterQuery and valueQuery accept regular SQL queries. Use {0} as the parameter representing the user input to filter values.

Create COUNTRY table:

create table COUNTRY (
CT_ID varchar(2),
CT_NAME varchar(32),
primary key(CT_ID)
);
insert into COUNTRY (CT_ID, CT_NAME) values ('es', 'Spain');
insert into COUNTRY (CT_ID, CT_NAME) values ('pt', 'Portugal');
insert into COUNTRY (CT_ID, CT_NAME) values ('it', 'Italy');

Form definition:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE workflow-forms PUBLIC "-//OpenKM//DTD Workflow Forms 2.6//EN"
"http://www.openkm.com/dtd/workflow-forms-2.6.dtd">
<workflow-forms>
<workflow-form task="suggestbox test">
<suggestbox label="country" name="country"
width="200px" dialogTitle="Choose country" filterMinLen="3"
filterQuery="select ct_id, ct_name from country where ct_name like '%{0}%' order by ct_name"
valueQuery="select ct_id, ct_name from country where ct_id='{0}'" />
</workflow-form>
</workflow-forms>

To obtain a list from external applications or for other purposes, a custom class can be built to retrieve option values from those systems.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE workflow-forms PUBLIC "-//OpenKM//DTD Workflow Forms 2.6//EN"
"http://www.openkm.com/dtd/workflow-forms-2.6.dtd">
<workflow-forms>
<workflow-form task="suggestbox test">
<suggestbox label="country" name="country"
width="200px" dialogTitle="Choose country" filterMinLen="3"
className="com.openkm.plugin.form.values.SuggestBoxUserList" />
</workflow-form>
</workflow-forms>

For more information, read Creating your own Suggestbox plugin