Created
June 30, 2015 07:12
-
-
Save avtaniket/7eb1745f161ef86efce1 to your computer and use it in GitHub Desktop.
Conditionaly adding Field Validation to the Edit View in SugarCRM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
({ | |
extendsFrom: 'RecordView', | |
initialize: function (options) { | |
this._super('initialize', [options]); | |
//add validation | |
this.model.addValidationTask('note', _.bind(this.doValidateTicketNote, this)); | |
}, | |
/* add validation for note */ | |
doValidateTicketNote: function(fields, errors, callback) { | |
if (_.isEmpty(this.model.get('note'))) { | |
errors['note'] = errors['note'] || {}; | |
errors['note'].required = true; | |
} | |
callback(null, fields, errors); | |
}, | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment