Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: multi choice checkbox #331

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 29 additions & 3 deletions content/layers.md
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,8 @@ type | format | required | readonly | maxLength | constraint | Description
`text` | string | supported | supported | supported || Text input
`textarea` | string | supported | supported | supported || Text input with resizable box
`dropdown` | string || supported || supported | Dropdown based on options values
`checkbox` | boolean or configured values || supported ||| Checkbox, defaults to not checked.
`checkbox` | boolean or configured values || supported ||| Checkbox, defaults not checked.
`checkboxgroup` | array with configured values || supported ||| A group of checkboxes where multiple choices can be selected and also freetext choices can be added, defaults to not checked.
`image` | base64 || supported ||| Uploads image
`color` | hexadecimal || supported ||| Activates a color-picker
`time` | hh:mm:ss | supported | supported ||| Defaults to current time. Use defaultTime:false to not.
Expand Down Expand Up @@ -890,6 +891,7 @@ Property | Description | Required | Default value
`valueQueryParameter`| When using `useBackingValue` in combination with `dynamic` the GET parameter name that is used for reverse lookup can be set using this parameter | No | "value"

**defaultValue object**

The defaultValue object controls how an attribute's default value is handled. Default values are always set when creating new features, and can optionally be set when updating attributes.
Default values can be overridden in the attribute editor unless attribute is configured as readonly or hidden.

Expand All @@ -901,8 +903,8 @@ Property | Description | Required | Default value
`timeStampFormat`| One of `time` = "HH:mm:ss", `date`= "yyyy-MM-dd", `datetime` = "yyyy-MM-dd HH:mm:ss", `timestamp` = "yyyy-MM-ddTHH:mm:ss | No | `timestamp`
`useUTC` | `true`if time should be in UTC, otherwise local time | No | `false`


**checkbox Config object**

An object that defines additional configuration for checkbox. The entire object is optional and all
properties are set to default if omitted.

Expand All @@ -911,6 +913,19 @@ Property | Description | Required | Default value
`uncheckedValue` | Value that corresponds to the unchecked state | No | 0 (false)
`checkedValue` | Value that corresponds to the checked state | No | 1 (true)

**checkboxgroup additional attributes and options array syntax**

Attribute option | Description
---|---
`separator` | The separator to be used to differentiate the values. Defaults to `;`.
`freetextOptionPrefix` | The prefix text in the value to be uesd to differentiate that this is a freetext value. Defaults to `freetext_option:`.
`freetextOptionValueSeparator`| The sign used to differentiate the unique freetext option and it's value. Defaults to `=`.

For the checkboxgroup attribute type an array can be supplied used to set up multiple choice type checkbox questions.
The array contains a object with the key `text` strings that should be able to select between.
Optional the object can have the key `value` which holds an alternative value for the option. Defaults to the `text` if not supplied.
By adding to the object the type `textbox`, a textbox is attached to the option, the text box is enabled only if the option is checked. This can be used as an "other"/"miscellaneous" free text option.

#### Example editor attributes

```json
Expand All @@ -931,6 +946,17 @@ Property | Description | Required | Default value
"uncheckedValue": "false"
}
},
{
"name": "multiChoice",
"title": "Please select all that applies: ",
"type": "checkboxgroup",
"options": [
{ "text": "choice 1" },
{ "text": "choice 2", "value": 2 },
{ "text": "choice 3" },
{ "text": "choice other", "type": "textbox" }
]
},
{
"name": "category",
"title": "category: ",
Expand Down Expand Up @@ -1323,4 +1349,4 @@ WMS servers can usually serve getFeatureInfo requests with a text/html reply. So

It is advisable to check the default function in src/getfeatureinfo.js to see the form of what is to be returned depending on whether a `htmlSeparator` prop is provided.

Note that the `source` of the [WMS](#wms) layer must have the `type` prop with the `geoserver` value for the `text/html` value of the `infoFormat` property to have the proper effect.
Note that the `source` of the [WMS](#wms) layer must have the `type` prop with the `geoserver` value for the `text/html` value of the `infoFormat` property to have the proper effect.