From c9cf5aebeaa159580b1ed6e35c1155de9602063d Mon Sep 17 00:00:00 2001 From: Pranav Nachanekar Date: Tue, 24 Sep 2019 12:08:37 +0530 Subject: [PATCH] Changed required values, add clientside validation --- erpnext/crm/doctype/appointment/appointment.json | 8 +++----- erpnext/www/book-appointment/index.html | 14 ++++++-------- erpnext/www/book-appointment/index.js | 7 ++++++- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/erpnext/crm/doctype/appointment/appointment.json b/erpnext/crm/doctype/appointment/appointment.json index 22df5c6aa8..9dfcc57197 100644 --- a/erpnext/crm/doctype/appointment/appointment.json +++ b/erpnext/crm/doctype/appointment/appointment.json @@ -35,14 +35,12 @@ { "fieldname": "customer_phone_number", "fieldtype": "Data", - "label": "Phone Number", - "reqd": 1 + "label": "Phone Number" }, { "fieldname": "customer_skype", "fieldtype": "Data", - "label": "Skype ID", - "reqd": 1 + "label": "Skype ID" }, { "fieldname": "customer_details", @@ -95,7 +93,7 @@ "fieldtype": "Column Break" } ], - "modified": "2019-09-23 10:57:04.876506", + "modified": "2019-09-24 11:44:21.228104", "modified_by": "Administrator", "module": "CRM", "name": "Appointment", diff --git a/erpnext/www/book-appointment/index.html b/erpnext/www/book-appointment/index.html index 2e0321394e..1f6dd2e0e6 100644 --- a/erpnext/www/book-appointment/index.html +++ b/erpnext/www/book-appointment/index.html @@ -45,16 +45,14 @@
- - - - +
+ + + + +
diff --git a/erpnext/www/book-appointment/index.js b/erpnext/www/book-appointment/index.js index 345e614154..6034f4eb48 100644 --- a/erpnext/www/book-appointment/index.js +++ b/erpnext/www/book-appointment/index.js @@ -195,7 +195,11 @@ function setup_details_page() { } async function submit() { - // form validation here + let form = document.querySelector('#customer-form'); + if(!form.checkValidity()){ + form.reportValidity(); + return; + } get_form_data(); let appointment = (await frappe.call({ method: 'erpnext.www.book-appointment.index.create_appointment', @@ -212,6 +216,7 @@ async function submit() { } function get_form_data() { + contact = {}; contact.name = document.getElementById('customer_name').value; contact.number = document.getElementById('customer_number').value;