Skip to content

Instantly share code, notes, and snippets.

@jsmarkus
Last active December 14, 2015 15:18
Show Gist options
  • Save jsmarkus/5106508 to your computer and use it in GitHub Desktop.
Save jsmarkus/5106508 to your computer and use it in GitHub Desktop.
var opt = new Option({
field: 'decorations'
trigger: 'Рюшечки 2Б',
calc: function() {
var razv = this.getOption('razv');
var price = 30 * (razv + 1);
return price;
},
validate: function () {
var mat = this.getOption('material');
if(mat === 'Кожа') {
//возвращаем признак того, что сработало ограничение
return new ValidationError{
code : 'RESCRICTION',
message : 'На коже рюшечки 2Б не делаются'
}
} else {
//все нормально
return false;
}
}
});
calc.add(opt);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment