HI All,
I got a code and its not really working well in how I use indexOf(). Please enlighten me. Here's my code:
({
extendsFrom:'RecordView',
initialize:function(options){
this._super('initialize',[options]);
this.context.on('button:save_button:click',this.concatField, this);
},
concatField: function(field) {
var field_two_c = this.model.get('field_two_c'),
space = " ",
field_one_c = this.model.get('field_one_c');
if (_.indexOf(field_one_c,field_two_c) == -1){
this.model.set('field_one_c', field_one_c+space+field_two_c);
}
else{
this.model.set('field_one_c', field_one_c);
}
},
})
Everytime i click Save, the fields concats. I dont want to concat it when field_one_c contain some string from field_two_c.
Thanks,
Longki