Difference between revisions of "Form Element description"

From OpenKM Documentation
Jump to: navigation, search
(Select)
(Suggestbox)
Line 21: Line 21:
 
* '''dialogTitle''': The text which describes the title of the dialog. '''Required'''.
 
* '''dialogTitle''': The text which describes the title of the dialog. '''Required'''.
 
* '''filterMinLen''': The minimum chars in input to begin to filter results.
 
* '''filterMinLen''': The minimum chars in input to begin to filter results.
 +
 +
===Example===
 +
<source lang="xml">
 +
<suggestbox label="Provincia" name="okp:hegeco.provincia" width="200px"
 +
  table="provincia" dialogTitle="Seleccionar Provincia" filterMinLen="3"
 +
  filterQuery="select $pro_id, $pro_nombre from DatabaseMetadataValue dmv where dmv.table='provincia' and lower(dmv.$pro_nombre) like '%{0}%' order by dmv.$pro_nombre"
 +
  valueQuery="select $pro_id, $pro_nombre from DatabaseMetadataValue dmv where dmv.table='provincia' and dmv.$pro_id='{0}'" />
 +
</source>
  
 
== Checkbox ==
 
== Checkbox ==

Revision as of 10:04, 18 October 2012

Input

Used to enter free form text:

  • label: The text which describes the component. Required.
  • name: This value is used to access the value typed by the user. Required.
  • type: This value constrain value type. Allowed types: text, date, link or folder.
  • value: Here you can specify a default value for this component.
  • width: The width of the component. Defaults to browser default HTML input width.
  • height: The height of the component. Defaults to browser default HTML input height.

Suggestbox

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

  • label: The text which describes the component. Required.
  • name: This value is used to access the value typed by the user. Required.
  • table: The table where the data is stored.
  • filterQuery: An Hibernate query to filter the data. Use {0} to place the user input. Required.
  • valueQuery: An Hibernate query to obtain the value of a identifier. Use {0} to place the identifier. Required.
  • dialogTitle: The text which describes the title of the dialog. Required.
  • filterMinLen: The minimum chars in input to begin to filter results.

Example

<suggestbox label="Provincia" name="okp:hegeco.provincia" width="200px"
   table="provincia" dialogTitle="Seleccionar Provincia" filterMinLen="3"
   filterQuery="select $pro_id, $pro_nombre from DatabaseMetadataValue dmv where dmv.table='provincia' and lower(dmv.$pro_nombre) like '%{0}%' order by dmv.$pro_nombre"
   valueQuery="select $pro_id, $pro_nombre from DatabaseMetadataValue dmv where dmv.table='provincia' and dmv.$pro_id='{0}'" />

Checkbox

Best used to represent boolean data:

  • label: The text which describes the component. Required.
  • name: This value is used to access the value typed by the user. Required.

TextArea

Similar to Input but for bigger text:

  • label: The text which describes the component. Required.
  • name: This value is used to access the value typed by the user. Required.
  • value: Here you can specify a default value for this component.
  • width: The width of the component. Defaults to 300px.
  • height: The height of the component. Defaults to 100px.

Select

In this case, the value can be selected from a list of predefined one. Every select component can contain an arbitrary number of options bigger than one.

  • label: The text which describes the component. Required.
  • name: This value is used to access the value selected by the user. Required.
  • type: Actually can be only "simple". Simple means that only one option can be selected at a time. Defaults to "simple".
  • width: The width of the component. Defaults to browser default HTML select width.
  • height: The height of the component. Defaults to browser default HTML select height.

Since OpenKM 6.1 you have a couple of new properties to get the select option values from a database query. Look at issue 2258 to see a sample use of these new values:

  • table: The metadata table used in this query.
  • optionsQuery: A metadata query used to obtain the select options.

Option

  • label: The text which describes the component. Required.
  • value: This is the value of the option to be selected. Required.
  • selected: Can be "true" or "false". Indicates if the option is selected by default or not. Defaults to "false".

Separator

Represent a way to draw a separator to group different elements.

  • label: The text which describes the component. Required.
  • name: This value is used to access the value selected by the user. Required.

Text

Print a text which can contain HTML tags.

  • label: The text which describes the component. Required.
  • name: This value is used to access the value selected by the user. Required.