Reputation: 135
From the screenshot of my form:
Upvotes: 0
Views: 650
Reputation: 6347
For Dropdown-Input
combo I would go with two model fields: ContractType
and CustomContractType
. For the ContractType
I would specify possibleValues
(Type One, Type Two, Type Three, ..., Other) in advanced field settings and bind them to Dropdown
's options:
@models.ModelName.fields.ContractType.possibleValues
and bind value to ContractType
field:
@datasource.item.ContractType
Then I would bind visible
or enabled
Input
's property to
@datasource.item.ContractType === 'Other'
and bind value to CustomContractType
field:
@datasource.item.CustomContractType
and enforce this logic in onBeforeCreate
and onBeforeSave
model events:
if (record.ContractType !== 'Other' && record.CustomContractType !== null) {
record.CustomContractType = null; // or throw exception...
}
if (record.ContractType === 'Other' && record.CustomContractType === null) {
throw new Error('CustomContractType is required');
}
Renewal notice(notices?)
In case you need to select only one renewal notice, I would recommend to use Radio Group
widget. Otherwise you can keep using multiple checkboxes and introduce multiple model fields for each checkbox OR use Multiselect
select widget and try to mate it with string model's field in combination with split binding transformer (you can find sample in Document Approval template, Admin/Settings page).
Upvotes: 1