Changed required values, add clientside validation
This commit is contained in:
parent
558d44e519
commit
c9cf5aebea
@ -35,14 +35,12 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "customer_phone_number",
|
"fieldname": "customer_phone_number",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"label": "Phone Number",
|
"label": "Phone Number"
|
||||||
"reqd": 1
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "customer_skype",
|
"fieldname": "customer_skype",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"label": "Skype ID",
|
"label": "Skype ID"
|
||||||
"reqd": 1
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "customer_details",
|
"fieldname": "customer_details",
|
||||||
@ -95,7 +93,7 @@
|
|||||||
"fieldtype": "Column Break"
|
"fieldtype": "Column Break"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"modified": "2019-09-23 10:57:04.876506",
|
"modified": "2019-09-24 11:44:21.228104",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "CRM",
|
"module": "CRM",
|
||||||
"name": "Appointment",
|
"name": "Appointment",
|
||||||
|
|||||||
@ -45,16 +45,14 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="row justify-content-center mt-3">
|
<div class="row justify-content-center mt-3">
|
||||||
<div class="col-md-4 align-items-center">
|
<div class="col-md-4 align-items-center">
|
||||||
<input class="form-control mt-3" type="text" name="customer_name" id="customer_name" placeholder="Your Name"
|
<form id="customer-form" action='#'>
|
||||||
required>
|
<input class="form-control mt-3" type="text" name="customer_name" id="customer_name" placeholder="Your Name (required)"required>
|
||||||
<input class="form-control mt-3" type="tel" name="customer_number" id="customer_number"
|
<input class="form-control mt-3" type="tel" name="customer_number" id="customer_number" placeholder="+910000000000">
|
||||||
placeholder="Contact Number" required>
|
<input class="form-control mt-3" type="text" name="customer_skype" id="customer_skype" placeholder="Skype">
|
||||||
<input class="form-control mt-3" type="text" name="customer_skype" id="customer_skype" placeholder="Skype"
|
<input class="form-control mt-3"type="email" name="customer_email" id="customer_email" placeholder="Email Address (required)"required>
|
||||||
required>
|
|
||||||
<input class="form-control mt-3"type="email" name="customer_email" id="customer_email"
|
|
||||||
placeholder="Email Address">
|
|
||||||
<textarea class="form-control mt-3" name="customer_notes" id="customer_notes" cols="30" rows="10"
|
<textarea class="form-control mt-3" name="customer_notes" id="customer_notes" cols="30" rows="10"
|
||||||
placeholder="Notes"></textarea>
|
placeholder="Notes"></textarea>
|
||||||
|
</form>
|
||||||
<div class="row mt-3 ">
|
<div class="row mt-3 ">
|
||||||
<div class="col-md"><button class="btn btn-dark form-control" onclick="initialise_select_date()">Go back</button></div>
|
<div class="col-md"><button class="btn btn-dark form-control" onclick="initialise_select_date()">Go back</button></div>
|
||||||
<div class="col-md"><button class="btn btn-primary form-control " onclick="submit()" id="submit-button">Submit</button></div>
|
<div class="col-md"><button class="btn btn-primary form-control " onclick="submit()" id="submit-button">Submit</button></div>
|
||||||
|
|||||||
@ -195,7 +195,11 @@ function setup_details_page() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function submit() {
|
async function submit() {
|
||||||
// form validation here
|
let form = document.querySelector('#customer-form');
|
||||||
|
if(!form.checkValidity()){
|
||||||
|
form.reportValidity();
|
||||||
|
return;
|
||||||
|
}
|
||||||
get_form_data();
|
get_form_data();
|
||||||
let appointment = (await frappe.call({
|
let appointment = (await frappe.call({
|
||||||
method: 'erpnext.www.book-appointment.index.create_appointment',
|
method: 'erpnext.www.book-appointment.index.create_appointment',
|
||||||
@ -212,6 +216,7 @@ async function submit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function get_form_data() {
|
function get_form_data() {
|
||||||
|
|
||||||
contact = {};
|
contact = {};
|
||||||
contact.name = document.getElementById('customer_name').value;
|
contact.name = document.getElementById('customer_name').value;
|
||||||
contact.number = document.getElementById('customer_number').value;
|
contact.number = document.getElementById('customer_number').value;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user