JSFiddle - React, Tailwind, and code Playground
by migontech
JavaScript
var _data = {
type: 'dropdown',
id: 'cust_contact_pref',
nsId: 'custrecord_tsp_web_cust_contact_pref',
label: 'Customer Contact Preference',
options: [{value: 1, label: '1'}, {value: 2, label: '2'}],
required: true,
validate: function(value, data, errors) {
var _errors = [];
if(typeof value !== 'string') {
_errors.push('Field is required');
} else if(value.trim().length) {
_errors.push('Field has invalid format. Should have length of 32 characters.');
}
return _errors;
}
};