Regex that works for the first character entered
This commit is contained in:
parent
d816c00a59
commit
327d8ea94d
6
resources/assets/js/views/common/items.js
vendored
6
resources/assets/js/views/common/items.js
vendored
@ -34,8 +34,10 @@ const app = new Vue({
|
|||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
'form.sale_price': function (newVal, oldVal) {
|
'form.sale_price': function (newVal, oldVal) {
|
||||||
if (newVal != '' && newVal.search('^(?=.*?[0-9])[0-9.,]+$') == -1) {
|
if (newVal != '' && newVal.search('^(?=.*?[0-9])[0-9.,]+$') === -1) {
|
||||||
this.form.sale_price = oldVal;
|
if(newVal.search('(?<!.).(?!.)') === -1){
|
||||||
|
this.form.sale_price = oldVal;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user