Home > @i2analyze/i2connect > services > IFormServiceConfig > form
services.IFormServiceConfig.form property
Gets the form definition, which configures a service to prompt for values that a user provides, subject to conditions that you specify.
Signature:
form?: BasicForm | SectionedForm;
Returns: BasicForm | SectionedForm
Introduced: API version 2.0
Example
The form in the following service results in users seeing an input field that guarantees the value of the octet
parameter to be in the configured range.
The value that the user provides is available in the acquire callback from the conditions
object.
addService(
{
name: 'Sample',
form: {
octet: {
label: 'IP address octet number',
description: 'A mandatory integer between 0 and 255',
logicalType: 'integer',
minValue: 0,
maxValue: 255,
mandatory: true,
},
},
},
({ conditions }) => {
console.log(conditions.octet);
...
}
);