| Server IP : 104.21.37.246 / Your IP : 104.23.243.32 [ Web Server : Apache System : Linux cpanel01wh.bkk1.cloud.z.com 2.6.32-954.3.5.lve1.4.59.el6.x86_64 #1 SMP Thu Dec 6 05:11:00 EST 2018 x86_64 User : cp648411 ( 1354) PHP Version : 7.2.34 Disable Function : NONE Domains : 0 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home2/cp648411/public_html/simded.com/include/ |
Upload File : |
function validate_text(evt) {
var theEvent = evt || window.event;
var key = theEvent.keyCode || theEvent.which;
key = String.fromCharCode( key );
var regex = /[0-9]|\./;
if( regex.test(key) ) {
theEvent.returnValue = false;
if(theEvent.preventDefault) theEvent.preventDefault();
}
}
function validate_th(evt) {
var theEvent = evt || window.event;
var key = theEvent.keyCode || theEvent.which;
key = String.fromCharCode( key );
var regex = /[A-Za-z0-9]|\./;
if( regex.test(key) ) {
theEvent.returnValue = false;
if(theEvent.preventDefault) theEvent.preventDefault();
}
}
function checkID(id)
{
if(id.length != 13) return false;
for(i=0, sum=0; i < 12; i++)
sum += parseFloat(id.charAt(i))*(13-i); if((11-sum%11)%10!=parseFloat(id.charAt(12)))
return false; return true;
}
function checkID_str(data)
{
text = data.substr(0, 1) + data.substr(2,4) + data.substr(7, 5) + data.substr(13,2) + data.substr(16,1);
return text;
}
function testHoldon(themeName){
HoldOn.open({
theme:themeName,
message:"<h4> กำลังบันทึกข้อมูล </h4>"
});
}
function testHoldon_cl(themeName)
{
setTimeout(function(){
HoldOn.close();
},0);
}
function Ajax_turnpages(v_page,file,reply)
{
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById(reply).innerHTML = this.responseText;
}
};
xmlhttp.open("GET", "../include/"+file+"?page_number="+v_page, true);
xmlhttp.send();
}
function AjaxFM_turnpages(v_page,file,fm,reply)
{
//testHoldon('sk-rect');
$.ajax({
url: "../include/"+file, // Url to which the request is send
type: "POST", // Type of request to be send, called as method
data: $(fm).serialize()+'&page_number='+v_page,
cache: false, // To unable request pages to be cached
processData:false, // To send DOMDocument or non processed data file it is set to false
success: function(data) // A function to be called if request succeeds
{
//testHoldon_cl('sk-circle');
$(reply).html(data);
}
});
}
function search_teacher(page)
{
testHoldon('sk-rect');
$.ajax({
url: "../include/ajax_predictsearch_page.php", // Url to which the request is send
type: "POST", // Type of request to be send, called as method
data: $("#fm_leavenumber_search").serialize()+'&page_number='+page,
cache: false, // To unable request pages to be cached
processData:false, // To send DOMDocument or non processed data file it is set to false
success: function(data) // A function to be called if request succeeds
{
testHoldon_cl('sk-circle');
$("#PredictM4").html(data);
}
});
}
function savefm_leavenumber_load()
{
testHoldon('sk-rect');
$.ajax({
url: "../include/ajax_leavenumber.php", // Url to which the request is send
type: "POST", // Type of request to be send, called as method
data: $("#fm_leavenumber").serialize(),
cache: false, // To unable request pages to be cached
processData:false, // To send DOMDocument or non processed data file it is set to false
success: function(data) // A function to be called if request succeeds
{
testHoldon_cl('sk-circle');
$('input[type=text]').val('');
$('input[type=email]').val('');
$('#detail').val('');
$("#Hint_leavenumber").html(data);
}
});
}
function savefm_regi_shop_load()
{
testHoldon('sk-rect');
$.ajax({
url: "../include/ajax_regi_shop.php", // Url to which the request is send
type: "POST", // Type of request to be send, called as method
data: $("#fm_reg_shop").serialize(),
cache: false, // To unable request pages to be cached
processData:false, // To send DOMDocument or non processed data file it is set to false
success: function(data) // A function to be called if request succeeds
{
testHoldon_cl('sk-circle');
$("#alert_regi_shop").html(data);
}
});
}
function FM_search(name,params)
{
method = "post";
path = "../search/index.php";
var form = document.createElement("form");
form.setAttribute("method", method);
form.setAttribute("action", path);
var hiddenField = document.createElement("input");
hiddenField.setAttribute("type", "hidden");
hiddenField.setAttribute("name", name);
hiddenField.setAttribute("value", params);
form.appendChild(hiddenField);
document.body.appendChild(form);
form.submit();
}
function reset_search()
{
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
window.location.href = '../search/index.php';
}
};
xmlhttp.open("GET", "../include/ajax_reset_search.php", true);
xmlhttp.send();
}
function like(type,phone)
{
if(type == 1)
{
$.ajax({
url: "../include/ajax_favorite.php", // Url to which the request is send
type: "POST", // Type of request to be send, called as method
data: 'id='+phone,
cache: false, // To unable request pages to be cached
processData:false, // To send DOMDocument or non processed data file it is set to false
success: function(data) // A function to be called if request succeeds
{
testHoldon_cl('sk-circle');
if(data== false )
{swal("เบอร์นี้เป็นเบอร์โปรดอยู่แล้ว!");}
else{ swal(" เพิ่มเป็นเบอร์โปรดเรียบร้อยแล้วค่ะ"); $("#alert_like").html(data); }
}
});
}
else
{
swal("กรุณาเข้าสู่ระบบก่อน จึงจะสามารถเพิ่มเบอร์โปรดได้!");
}
}
function favoriteDelete()
{
if( $('input[name="chk[]"]:checked').length > 0)
{
swal({
title: "ยืนยันการลบข้อมูล ?",
text: "คุณจะไม่สามารถกู้ข้อมูลคืนกลับได้ !",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "ยืนยันการลบข้อมูล",
cancelButtonText: "ยกเลิก",
closeOnConfirm: false
},
function(isConfirm){
if (isConfirm) {
swal.close();
testHoldon('sk-rect');
$.ajax({
url: "../include/ajax_deletefavoriteAll.php", // Url to which the request is send
type: "POST", // Type of request to be send, called as method
data: $("#fmfavorite").serialize(),
cache: false, // To unable request pages to be cached
processData:false, // To send DOMDocument or non processed data file it is set to false
success: function(data) // A function to be called if request succeeds
{
testHoldon_cl('sk-circle');
swal({
title: "การแจ้งเตือน !!!",
text: "ข้อมูลที่คุณเลือกถูกลบเรียบร้อยแล้วค่ะ",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "ตกลง",
closeOnConfirm: false,
closeOnCancel: false,
showCancelButton: false,
},
function(isConfirm){
if (isConfirm) {
//window.location.reload();
window.location.href = '../favorite/index.php';
}
});
}
});
}
});
}
else
{
swal({
title: "การแจ้งเตือน !!!",
text: "กรุณาเลือกข้อมูลที่ต้องการจะลบ",
type: "warning",
confirmButtonColor: "#8cd4f5",
confirmButtonText: "ตกลง",
});
}
}
$(function(){
$('.checkall').on('click', function() {
$('.child').prop('checked', this.checked)
});
});
$(document).ready(function() {
$("#idcard").mask("9-9999-99999-99-9");
function randomNumber(min, max) {
return Math.floor(Math.random() * (max - min + 1) + min);
}
function CK_idcard(data)
{
var idcard = checkID_str(data);
//var idcard = checkID_str(document.fm_reg_shop.idcard.value);
var ck_idcard = checkID(idcard);
return ck_idcard;
}
$('#fm_reg_member').bootstrapValidator({
fields: {
name: {
validators: {
notEmpty: {
message: 'กรุณากรอกชื่อ '
}
}
},
lastname: {
validators: {
notEmpty: {
message: 'กรุณากรอกนามสกุล '
}
}
},
password: {
validators: {
notEmpty: {
message: 'กรุณากรอกรหัสผ่าน '
},
identical: {
field: 'password_con',
message: 'รหัสผ่านและการยืนยันไม่ถูกต้องหรือไม่เหมือนกัน'
},
stringLength: {
min: 6,
message: 'รหัสผ่าน ต้องไม่ต่ำกว่า 6 ตัวอักษร'
}
}
},
password_con: {
validators: {
notEmpty: {
message: 'กรุณากรอกยืนยันรหัสผ่าน '
},
identical: {
field: 'password',
message: 'รหัสผ่านและการยืนยันไม่ถูกต้องหรือไม่เหมือนกัน'
},
stringLength: {
min: 6,
message: 'รหัสผ่าน ต้องไม่ต่ำกว่า 6 ตัวอักษร'
}
}
},
phone: {
validators: {
notEmpty: {
message: 'กรุณากรอกเบอร์โทรศัพท์ '
},
stringLength: {
min: 10,
message: 'กรุณากรอกเบอร์โทรศัพท์ อย่างน้อย 10 หลัก'
}
}
},
email: {
validators: {
notEmpty: {
message: 'กรุณากรอกอีเมล '
},
remote: {
message: 'อีเมลนี้ถูกใช้ลงทะเบียนแล้วค่ะ',
url: '../include/ajxa_ck_email.php?regitype=member',
type: 'POST'
},
}
},
}
})
.on('success.form.bv', function(e) {
$('#fm_reg_member').data('bootstrapValidator').resetForm();
e.preventDefault();
var $form = $(e.target);
var bv = $form.data('bootstrapValidator'); //testHoldon('sk-rect');
$.ajax({
url: "../include/register_member.php", // Url to which the request is send
type: "POST", // Type of request to be send, called as method
data: $("#fm_reg_member").serialize()+'®itype=member',
cache: false, // To unable request pages to be cached
processData:false, // To send DOMDocument or non processed data file it is set to false
success: function(data) // A function to be called if request succeeds
{
//testHoldon_cl('sk-circle');
$("#alert_regi_member").html(data);
}
});
})
$('#fm_ed_member').bootstrapValidator({
fields: {
name: {
validators: {
notEmpty: {
message: 'กรุณากรอกชื่อ '
}
}
},
lastname: {
validators: {
notEmpty: {
message: 'กรุณากรอกนามสกุล '
}
}
},
phone: {
validators: {
notEmpty: {
message: 'กรุณากรอกเบอร์โทรศัพท์ '
},
stringLength: {
min: 10,
message: 'กรุณากรอกเบอร์โทรศัพท์ อย่างน้อย 10 หลัก'
}
}
}
}
})
.on('success.form.bv', function(e) {
$('#fm_ed_member').data('bootstrapValidator').resetForm();
e.preventDefault();
var $form = $(e.target);
var bv = $form.data('bootstrapValidator'); //testHoldon('sk-rect');
$.ajax({
url: "../include/edit_member.php", // Url to which the request is send
type: "POST", // Type of request to be send, called as method
data: $("#fm_ed_member").serialize()+'®itype=member',
cache: false, // To unable request pages to be cached
processData:false, // To send DOMDocument or non processed data file it is set to false
success: function(data) // A function to be called if request succeeds
{
//testHoldon_cl('sk-circle');
$("#alert_ed_member").html(data);
}
});
})
$('#fm_leavenumber_search').bootstrapValidator({
fields: {
phone_search: {
validators: {
notEmpty: {
message: 'กรุณากรอกเบอร์โทรศัพท์ '
}
}
}
}
})
.on('success.form.bv', function(e) {
$('#fm_leavenumber_search').data('bootstrapValidator').resetForm();
e.preventDefault();
var $form = $(e.target);
var bv = $form.data('bootstrapValidator');
search_teacher(0);
})
/*$('#fm_reading').bootstrapValidator({
fields: {
phonenumber: {
validators: {
notEmpty: {
message: 'กรุณากรอกเบอร์โทรศัพท์ '
},
stringLength: {
min: 10,
message: 'กรุณากรอกเบอร์โทรศัพท์ 10 หลัก'
}
}
}
}
})
.on('success.form.bv', function(e) {
$('#fm_reading').data('bootstrapValidator').resetForm();
e.preventDefault();
var $form = $(e.target);
var bv = $form.data('bootstrapValidator');
fm_reading.submit();
})*/
$('#fm_leavenumber').bootstrapValidator({
fields: {
phonenumber: {
validators: {
notEmpty: {
message: 'กรุณากรอกเบอร์โทรศัพท์ '
},
stringLength: {
min: 10,
message: 'กรุณากรอกเบอร์โทรศัพท์ 10 หลัก'
},
callback: {
callback: function(value, validator, $field) {
if (value === '') {
return true;
}
if (value.substring (0,1) > 0) {
return {
valid: false,
message: '<br> กรุณากรอกหมายเลขโทรศัพท์ที่ขึ้นต้นด้วย 0 '
};
}
return true;
}
},
}
},
email: {
validators: {
notEmpty: {
message: 'กรุณากรอกอีเมล'
}
}
}
}
})
.on('success.form.bv', function(e) {
$('#fm_leavenumber').data('bootstrapValidator').resetForm();
e.preventDefault();
var $form = $(e.target);
var bv = $form.data('bootstrapValidator');
savefm_leavenumber_load();
})
$('#fm_regi_professor').bootstrapValidator({
fields: {
name: {
validators: {
notEmpty: {
message: 'กรุณากรอกชื่อ'
}
}
},
lastname: {
validators: {
notEmpty: {
message: 'กรุณากรอกนามสกุลชื่อ'
}
}
},
email: {
validators: {
notEmpty: {
message: 'กรุณากรอกอีเมล'
},
remote: {
message: 'อีเมลนี้ถูกใช้ลงทะเบียนแล้วค่ะ',
url: '../include/ajxa_ck_email.php?regitype=professor',
type: 'POST'
},
}
},
idcard: {
validators:{
notEmpty: {
message: 'กรุณากรอกเลขบัตรประชาชน'
},
stringLength: {
min: 17,
message: 'กรุณากรอกเลขบัตรประชาชน 13 หลัก'
},
callback: {
//message: 'กรุณากรอกเลขบัตรประชาชน',
callback: function(value, validator, $field) {
if (value === '') {
return true;
}
var ck = CK_idcard(value);
if (ck == false) {
return {
valid: false,
message: 'หมายเลขบัตรประชาชนไม่ถูกต้อง'
};
}
return true;
}
},
remote: {
message: 'หมายเลขบัตรประชาชนนี้ถูกใช้ลงทะเบียนแล้วค่ะ',
url: '../include/ajxa_ck_idcard.php?regitype=professor',
type: 'POST'
},
}
},
nameprophecy: {
validators: {
notEmpty: {
message: 'กรุณากรอกชื่อสำหรับพยากรณ์'
}
}
},
science: {
validators: {
notEmpty: {
message: 'กรุณากรอกศาสตร์ที่ใช้พยากรณ์์'
}
}
},
phone: {
validators: {
notEmpty: {
message: 'กรุณากรอกเบอร์โทรศัพท์'
}
}
},
lineid: {
validators: {
notEmpty: {
message: 'กรุณากรอกLine ID'
}
}
},
title: {
validators: {
notEmpty: {
message: 'กรุณากรอกคำอธิบายตัวเองสั้นๆเพื่อดึงดูดให้ลูกค้าสนใจ'
}
}
},
/* file_idcard: {
validators: {
notEmpty: {
message: 'กรุณาอัพโหลดรูปบัตรประชาชน ของท่านเพื่อยืนยันตัวตน'
}
}
},*/
}
})
.on('success.form.bv', function(e) {
$('#fm_regi_professor').data('bootstrapValidator').resetForm();
e.preventDefault();
var $form = $(e.target);
var bv = $form.data('bootstrapValidator');
e.preventDefault();
testHoldon('sk-rect');
$.ajax({
url: "../include/ajax_regi_professor.php", // Url to which the request is send
type: "POST", // Type of request to be send, called as method
data: new FormData(this), // Data sent to server, a set of key/value pairs (i.e. form fields and values)
contentType: false, // The content type used when sending data to the server.
cache: false, // To unable request pages to be cached
processData:false, // To send DOMDocument or non processed data file it is set to false
success: function(data) // A function to be called if request succeeds
{
testHoldon_cl('sk-circle');
$("#txtHint1").html(data);
}
});
});
$('#fm_reg_shop').bootstrapValidator({
fields: {
idcard: {
validators:{
notEmpty: {
message: 'กรุณากรอกเลขบัตรประชาชน'
},
stringLength: {
min: 17,
message: 'กรุณากรอกเลขบัตรประชาชน 13 หลัก'
},
callback: {
//message: 'กรุณากรอกเลขบัตรประชาชน',
callback: function(value, validator, $field) {
if (value === '') {
return true;
}
var ck = CK_idcard(value);
if (ck == false) {
return {
valid: false,
message: 'หมายเลขบัตรประชาชนไม่ถูกต้อง'
};
}
return true;
}
},
remote: {
message: 'หมายเลขบัตรประชาชนนี้ถูกใช้ลงทะเบียนแล้วค่ะ',
url: '../include/ajxa_ck_idcard.php?regitype=shop',
type: 'POST'
},
}
},
name: {
validators: {
notEmpty: {
message: 'กรุณากรอกชื่อ'
}
}
},
lastname: {
validators: {
notEmpty: {
message: 'กรุณากรอกนามสกุลชื่อ'
}
}
},
nameShop: {
validators: {
notEmpty: {
message: 'กรุณากรอกชื่อร้านค้า'
}
}
},
dtail: {
validators: {
notEmpty: {
message: 'กรุณากรอกรายละเอียดผู้ขาย'
}
}
},
phone: {
validators: {
notEmpty: {
message: 'กรุณากรอกเบอร์โทรศัพท์'
}
}
},
email: {
validators: {
notEmpty: {
message: 'กรุณากรอกอีเมล'
},
remote: {
message: 'อีเมลนี้ถูกใช้ลงทะเบียนแล้วค่ะ',
url: '../include/ajxa_ck_email.php?regitype=shop',
type: 'POST'
},
}
},
address: {
validators: {
notEmpty: {
message: 'กรุณากรอกที่อยู่'
}
}
},
province: {
validators: {
notEmpty: {
message: 'กรุณาเลือกจังหวัด '
}
}
},
payment: {
validators: {
notEmpty: {
message: 'กรุณากรอกรายละเอียดการชำระเงิน'
}
}
},
receiveProducts: {
validators: {
notEmpty: {
message: 'กรุณากรอกรายละเอียดการรับสินค้า '
}
}
},
}
})
.on('success.form.bv', function(e) {
$('#fm_reg_shop').data('bootstrapValidator').resetForm();
e.preventDefault();
var $form = $(e.target);
var bv = $form.data('bootstrapValidator');
savefm_regi_shop_load();
});
$('#fm_reply').bootstrapValidator({
fields: {
detail: {
validators: {
notEmpty: {
message: 'กรุณากรอกความคิดเห็น'
}
}
}
}
})
.on('success.form.bv', function(e) {
$('#fm_reply').data('bootstrapValidator').resetForm();
e.preventDefault();
var $form = $(e.target);
var bv = $form.data('bootstrapValidator');
$.ajax({
url: "../include/ajax_reply.php", // Url to which the request is send
type: "POST", // Type of request to be send, called as method
data: new FormData(this), // Data sent to server, a set of key/value pairs (i.e. form fields and values)
contentType: false, // The content type used when sending data to the server.
cache: false, // To unable request pages to be cached
processData:false, // To send DOMDocument or non processed data file it is set to false
success: function(data) // A function to be called if request succeeds
{
testHoldon_cl('sk-circle');
$("#txtHint1").html(data);
}
});
})
function generateCaptcha2() {
$('#captchaOperation2').html([randomNumber(10, 50), '+', randomNumber(10, 50), '='].join(' '));
}
generateCaptcha2();
$('#fm_contact').bootstrapValidator({
fields: {
name: {
validators: {
notEmpty: {
message: 'กรุณากรอกชื่อ'
}
}
},
phone: {
validators: {
notEmpty: {
message: 'โปรดระบุหมายเลขโทรศัพท์ของคุณ'
}
}
},
email: {
validators: {
notEmpty: {
message: 'กรุณากรอกอีเมล'
}
}
},
message: {
validators: {
notEmpty: {
message: 'กรุณากรอกข้อความ'
}
}
},
captcha: {
validators: {
callback: {
message: 'กรุณากรอกผลรวมของตัวเลขให้ถูกต้อง',
callback: function (value, validator, $field) {
// Determine the numbers which are generated in captchaOperation
var items = $('#captchaOperation').html().split(' '),
sum = parseInt(items[0]) + parseInt(items[2]);
return value == sum;
}
}
}
},
}
})
.on('success.form.bv', function(e) {
$('#fm_contact').data('bootstrapValidator').resetForm();
e.preventDefault();
var $form = $(e.target);
var bv = $form.data('bootstrapValidator');
testHoldon('sk-rect');
$.ajax({
url: "../include/ajax_contact.php", // Url to which the request is send
type: "POST", // Type of request to be send, called as method
data: $("#fm_contact").serialize(),
cache: false, // To unable request pages to be cached
processData:false, // To send DOMDocument or non processed data file it is set to false
success: function(data) // A function to be called if request succeeds
{
testHoldon_cl('sk-circle');
$("#fm_contact").trigger('reset');
$("#alerthide").html(data);
}
});
});
$('#fm_fogetpass').bootstrapValidator({
fields: {
email: {
validators: {
notEmpty: {
message: 'กรุณากรอกอีเมล / ชื่อผู้ใช้ '
}
}
}
}
})
.on('success.form.bv', function(e) {
$('#fm_fogetpass').data('bootstrapValidator').resetForm();
e.preventDefault();
var $form = $(e.target);
var bv = $form.data('bootstrapValidator');
testHoldon('sk-rect');
$.ajax({
url: "../include/ajax_fogetpass.php", // Url to which the request is send
type: "POST", // Type of request to be send, called as method
data: $("#fm_fogetpass").serialize(),
cache: false, // To unable request pages to be cached
processData:false, // To send DOMDocument or non processed data file it is set to false
success: function(data) // A function to be called if request succeeds
{
testHoldon_cl('sk-circle');
$("#fm_fogetpass").trigger('reset');
$("#hidefogetpass").html(data);
}
});
})
$('#fm_resetpassword').bootstrapValidator({
fields: {
pass: {
validators: {
notEmpty: {
message: 'กรุณากรอกรหัสผ่าน '
},
identical: {
field: 'passcon',
message: 'รหัสผ่านและการยืนยันไม่ถูกต้องหรือไม่เหมือนกัน'
},
stringLength: {
min: 6,
message: 'รหัสผ่าน ต้องไม่ต่ำกว่า 6 ตัวอักษร'
}
}
},
passcon: {
validators: {
notEmpty: {
message: 'กรุณากรอกรหัสผ่าน '
},
identical: {
field: 'pass',
message: 'รหัสผ่านและการยืนยันไม่ถูกต้องหรือไม่เหมือนกัน'
},
stringLength: {
min: 6,
message: 'รหัสผ่าน ต้องไม่ต่ำกว่า 6 ตัวอักษร'
}
}
}
}
})
.on('success.form.bv', function(e) {
$('#fm_resetpassword').data('bootstrapValidator').resetForm();
e.preventDefault();
var $form = $(e.target);
var bv = $form.data('bootstrapValidator');
testHoldon('sk-rect');
$.ajax({
url: "../include/ajax_resetpassword.php", // Url to which the request is send
type: "POST", // Type of request to be send, called as method
data: $("#fm_resetpassword").serialize(),
cache: false, // To unable request pages to be cached
processData:false, // To send DOMDocument or non processed data file it is set to false
success: function(data) // A function to be called if request succeeds
{
testHoldon_cl('sk-circle');
$("#fm_resetpassword").trigger('reset');
$("#hideresetpass").html(data);
}
});
})
function generateCaptcha() {
$('#captchaOperation').html([randomNumber(10, 50), '+', randomNumber(10, 50), '='].join(' '));
}
generateCaptcha();
$('#fm_order').bootstrapValidator({
fields: {
shipping: {
validators: {
notEmpty: {
message: 'กรุณาเลือกรูปแบบการจัดส่ง '
}
}
},
name: {
validators: {
notEmpty: {
message: 'กรุณากรอกชื่อ '
}
}
},
lastname: {
validators: {
notEmpty: {
message: 'กรุณากรอกนามสกุล '
}
}
},
address: {
validators: {
notEmpty: {
message: 'กรุณากรอกที่อยู่'
}
}
},
province: {
validators: {
notEmpty: {
message: 'กรุณาเลือกจังหวัด '
}
}
},
zip: {
validators: {
notEmpty: {
message: 'กรุณากรอกรหัสไปรษณี '
},
stringLength: {
min: 5,
max: 5,
message: 'กรุณากรอกรหัสไปรษณี 5 หลัก'
}
}
},
phone: {
validators: {
notEmpty: {
message: 'กรุณากรอกเบอร์โทรศัพท์ติดต่อ '
},
stringLength: {
min: 10,
max: 10,
message: 'กรุณากรอกเบอร์โทรศัพท์ติดต่อ 10 หลัก'
}
}
},
mail: {
validators: {
notEmpty: {
message: 'กรุณากรอกอีเมล'
},
emailAddress: {
message: 'รูปแบบอีเมลไม่ถูกต้อง'
}
}
},
check: {
validators: {
notEmpty: {
message: 'กรุณายืนยันข้อมูลมข้างต้นนี้เป็นความจริง'
}
}
},
captcha: {
validators: {
callback: {
message: 'กรุณากรอกผลรวมของตัวเลขให้ถูกต้อง',
callback: function (value, validator, $field) {
// Determine the numbers which are generated in captchaOperation
var items = $('#captchaOperation').html().split(' '),
sum = parseInt(items[0]) + parseInt(items[2]);
return value == sum;
}
}
}
},
}
})
.on('success.form.bv', function(e) {
$('#fm_order').data('bootstrapValidator').resetForm();
e.preventDefault();
var $form = $(e.target);
var bv = $form.data('bootstrapValidator');
testHoldon('sk-rect');
fm_order.submit();
})
$('#fm_conorder').bootstrapValidator({
fields: {
check: {
validators: {
notEmpty: {
message: 'กรุณายืนยันข้อมูลมข้างต้นนี้เป็นความจริง'
}
}
},
}
})
.on('success.form.bv', function(e) {
$('#fm_conorder').data('bootstrapValidator').resetForm();
e.preventDefault();
var $form = $(e.target);
var bv = $form.data('bootstrapValidator');
testHoldon('sk-rect');
fm_conorder.submit();
})
$('#fm_lover').bootstrapValidator({
fields: {
lover_phone1: {
validators: {
notEmpty: {
message: 'กรุณากรอกเบอร์ของคุณ 10 หลัก'
},
stringLength: {
min: 10,
max: 10,
message: 'กรุณากรอกเบอร์ของคุณเป็นตัวเลข 10 หลัก'
}
}
},
lover_phone2: {
validators: {
notEmpty: {
message: 'กรุณากรอกเบอร์ของคู่รัก 10 หลัก '
},
stringLength: {
min: 10,
max: 10,
message: 'กรุณากรอกเบอร์ของคู่รักเป็นตัวเลข 10 หลัก'
}
}
}
}
})
.on('success.form.bv', function(e) {
$('#fm_lover').data('bootstrapValidator').resetForm();
e.preventDefault();
var $form = $(e.target);
var bv = $form.data('bootstrapValidator');
//testHoldon('sk-rect');
fm_lover.submit();
})
});
$(document).ready(function() {
$('#fm_reading')
.bootstrapValidator({
framework: 'bootstrap',
icon: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
phonenumber: {
validators: {
callback: {
callback: function(value, validator, $field) {
var channel = $('#fm_reading').find('[name="type"]').val();
if (channel == 'mobile') {
if (value == '') {
return {
valid: false,
message: 'กรุณากรอกเบอร์โทรศัพท์'
};
}else
{
if(isNaN(value))
{
return {
valid: false,
message: 'กรุณากรอกเบอร์โทรศัพท์เป็นตัวเลข 10 เท่านั้น'
};
}
else
{
if(value.length < 10){
return {
valid: false,
message: 'กรุณากรอกเบอร์โทรศัพท์ 10 หลัก'
};
}else if(value.length > 10){
return {
valid: false,
message: 'กรุณากรอกเบอร์โทรศัพท์ 10 หลัก'
};
}
}
}
}
if (channel == 'idcard') {
if (value == '') {
return {
valid: false,
message: 'กรุณากรอกหมายเลขบัตรประชาชน'
};
}
else
{
if(isNaN(value))
{
return {
valid: false,
message: 'กรุณากรอกหมายเลขบัตรประชาชนเป็นตัวเลข 13 เท่านั้น'
};
}
else
{
if(value.length < 13){
return {
valid: false,
message: 'กรุณากรอกหมายเลขบัตรประชาชน 13 หลัก'
};
}else if(value.length > 13){
return {
valid: false,
message: 'กรุณากรอกหมายเลขบัตรประชาชน 13 หลัก'
};
}
}
}
}
if (channel == 'homenumber') {
if (value == '') {
return {
valid: false,
message: 'กรุณากรอกเลขที่บ้าน'
};
}
}
if (channel == 'licenseplate') {
if (value == '') {
return {
valid: false,
message: 'กรุณากรอกทะเบียนรถ'
};
}
}
return true;
}
}
}
}
}
})
.on('change', '[name="type"]', function(e) {
$('#fm_reading').bootstrapValidator('revalidateField', 'phonenumber');
})
.on('success.field.fv', function(e, data) {
if (data.field === 'phonenumber') {
var channel = $('#fm_reading').find('[name="type"]').val();
if (channel !== 'other') {
data.element.closest('.form-group').removeClass('has-success');
data.element.data('fv.icon').hide();
}
}
fm_reading.submit();
});
});
function link_cart()
{
window.location.href = '../cart/list.php';
}