Author: Hugo Melo <hugo@riseup.net>
Fix validation on product modal
plugins/suppliers/public/javascripts/views/product-modal.tag.slim | 6
diff --git a/plugins/suppliers/public/javascripts/views/product-modal.tag.slim b/plugins/suppliers/public/javascripts/views/product-modal.tag.slim index 10b0da7d8be54509b20396af232d39a3bfb870ec..83df033a47bf03328231fd2d4df98c39efe82cea 100644 --- a/plugins/suppliers/public/javascripts/views/product-modal.tag.slim +++ b/plugins/suppliers/public/javascripts/views/product-modal.tag.slim @@ -227,11 +227,9 @@ if (keys[i] == 'supplier_id' && this.product.id) continue; // to validate category need to see the id instead of the input - if (keys[i] == 'product_category_id' && !this.product.product_category_id) + if (keys[i] == 'product_category_id' && !this.product.product_category_id.trim()) input.value = "" - console.log(input.value) - console.log(this.product.product_category_id) - if (input.value == "" || input.value == "0") { + if (input.value.trim() == "" || input.value == "0") { alert(this.t('views.product.validation_error_'+keys[i])) $("product-modal").scrollTo(100,1000) return false