AnsweredAssumed Answered

Custom error message not working in create.js

Question asked by Sino Thomas on Sep 19, 2019

Hello All,

 

I am trying this way to display a custom error message

 

({
extendsFrom: 'CreateView',
initialize: function (options) {

this._super('initialize', [options]);

app.error.errorName2Keys['custom_message'] = 'THIS IS MY CUSTOME MESSAGE';

//add validation tasks
this.model.addValidationTask('check_msg', _.bind(this._doValidateMsg, this));
},

_doValidateMsg: function(fields, errors, callback) {
//validate requirements
valid_dni = false;
if(valid_dni == false){
errors['field_name'] = errors['field_name'] || {};
errors['field_name'].custom_message = true;
}
callback(null, fields, errors);
},

})

 

But the function is always showing this 'Error Please resolve any errors before proceeding.' message. How can I display custom error message on this place ?

Outcomes