Workflow Suggestbox field

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

AttributeDescriptionRequired
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 width values based on %, 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 used to dynamically load the value.

false

readonly

When true, the field cannot be modified. Default is false. false

Child elements:

* There are two mutually exclusive ways to source suggest box values (one is mandatory):

  • filterQuery + valueQuery
  • className

No other combination is allowed.

Based on filterQuery and valueQuery

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>

Based on className

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