Created
June 30, 2015 07:22
-
-
Save avtaniket/d26c90b7b71314524830 to your computer and use it in GitHub Desktop.
Conditionaly adding Field Validation to the Create 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: 'CreateActionsView', | |
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