Hello everybody,
How to set a field number phone that dose not register if it doesn't contain at least 14 characters ?
I appreciate any help
Hello everybody,
How to set a field number phone that dose not register if it doesn't contain at least 14 characters ?
I appreciate any help
Hi Phuong Trinh ,
I believe you are seeking custom field validation. If so, you will likely want to review this article to add logic that prevents the record view save in the event of errors:
https://support.sugarcrm.com/documentation/sugar_developer/sugar_developer_guide_13.3/cookbook/adding_field_validation_to_the_record_view/
Heres a quick example I put together for a create view controller that checks for the name fields length. FYI, this hasn't been tested:
({ extendsFrom: 'CreateView', initialize: function (options) { this._super('initialize', [options]); //add validation tasks this.model.addValidationTask('check_length', _.bind(this._doValidateLength, this)); }, _doValidateLength: function(fields, errors, callback) { //validate length if (this.model.get('name').length < 5) { errors['name'] = errors['name'] || {}; errors['name'].required = true; } callback(null, fields, errors); } })
Hi Phuong Trinh ,
I believe you are seeking custom field validation. If so, you will likely want to review this article to add logic that prevents the record view save in the event of errors:
https://support.sugarcrm.com/documentation/sugar_developer/sugar_developer_guide_13.3/cookbook/adding_field_validation_to_the_record_view/
Heres a quick example I put together for a create view controller that checks for the name fields length. FYI, this hasn't been tested:
({ extendsFrom: 'CreateView', initialize: function (options) { this._super('initialize', [options]); //add validation tasks this.model.addValidationTask('check_length', _.bind(this._doValidateLength, this)); }, _doValidateLength: function(fields, errors, callback) { //validate length if (this.model.get('name').length < 5) { errors['name'] = errors['name'] || {}; errors['name'].required = true; } callback(null, fields, errors); } })