Browse Source

display order negative validation

master
Ubuntu 3 years ago
parent
commit
0965c19177
  1. 7
      smart_service/masters/doctype/vehicle/vehicle.js
  2. 6
      smart_service/masters/doctype/vehicle_segment/vehicle_segment.js

7
smart_service/masters/doctype/vehicle/vehicle.js

@ -88,7 +88,6 @@ frappe.ui.form.on('Vehicle', {
frappe.throw(__("Just a <b>.</b> is not prescribed!"));
frappe.validated = false;
}
//var regex = /^[A-Za-z0-9&-()@/,.<>_ ]*$/;
var regex = /[!@#$%^&*()_+\=\[\]{};'`~:"\\|.<>\/?]+/;
if (frm.doc.vehicle) {
if (regex.test(frm.doc.vehicle) === true) {
@ -102,6 +101,12 @@ frappe.ui.form.on('Vehicle', {
}
}
var regex = /[!@#$%^&*()_+-\=\[\]{};'`"\\|.<>\/?]+/;
if (regex.test(frm.doc.display_order) === true) {
frappe.throw(__("<b>Display Order:</b> negative values not allowed."));
frappe.validated = false;
}
if (frm.doc.display_order && frm.doc.vehicle && frm.doc.vehicle_segment && !frm.is_new()) {
//*** check if there is same display_order
frappe.db.get_list('Vehicle', {

6
smart_service/masters/doctype/vehicle_segment/vehicle_segment.js

@ -48,7 +48,11 @@ frappe.ui.form.on('Vehicle Segment', {
frappe.throw(__("Just a <b>.</b> is not prescribed!"));
frappe.validated = false;
}
//var regex = /^[A-Za-z0-9&-()@/,.<>_ ]*$/;
var regex = /[!@#$%^&*()_+-\=\[\]{};'`"\\|.<>\/?]+/;
if (regex.test(frm.doc.display_order) === true) {
frappe.throw(__("<b>Display Order:</b> negative values not allowed."));
frappe.validated = false;
}
var regex = /[!@#$%^&*()_+\-=\[\]{};'`~:"\\|,.<>\/?]+/;
if(frm.doc.vehicle_segment){
if (regex.test(frm.doc.vehicle_segment) === true){

Loading…
Cancel
Save