
I recently was asked how to define picklists in the mobile client to follow the validation logic that the full web client does.
lets look at how to add a fully new picklist to a form, in this case the edit address screen, to add the County field in.
// add county
this.registerCustomization(‘edit’, ‘address_edit’, {
at: function(row) { return row.name == ‘Country’; },
type: ‘insert’,
where: ‘before’,
value: {
label: ‘county’,
name: ‘County’,
property: ‘County’,
type: ‘picklist’,
picklist: ‘County’,
requireSelection: true,
title: ‘county’,
validator: [
validator.exists,
validator.exceedsMaxTextLength
]
}
});
The two highlighted lines above show what needs to be set.
requireSeclection: true makes typing into the picklist control not possible. Instead, as soon as you click in to the field the picklist popup occurs and you have to choose one of the items. This is the equivalent to “item must match”.
validator.exists prevents the “none” option at the top of the list of picklist items. it also throws an error if trying to save without choosing a value. This is the equivalent of the “Required entry”.
If you wanted to modify an existing picklist on a form instead of adding a new one the code would look like this:
// modify country
this.registerCustomization(‘edit’, ‘address_edit’, {
at: function(row) { return row.name == ‘Country’; },
type: ‘modify’,
value: {
requireSelection: true,
validator: [
validator.exists,
validator.exceedsMaxTextLength
]
}
});
Oh and finally to make multi-select you would do something like
// modify country
this.registerCustomization(‘edit’, ‘address_edit’, {
at: function(row) { return row.name == ‘Country’; },
type: ‘modify’,
value: {
requireSelection: true,
multiSelect: true,
validator: [
validator.exists,
validator.exceedsMaxTextLength
]
}
});
Subscribe To Our Newsletter
Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!
You have Successfully Subscribed!