Commit d4fcafc3 by Zen-PC\Zen

Zen : update profiles/index validation cakephp

parent adc4a768
...@@ -65,7 +65,7 @@ use Cake\I18n\Time; ...@@ -65,7 +65,7 @@ use Cake\I18n\Time;
<div class="col-xs-12 col-sm-12 col-md-12"> <div class="col-xs-12 col-sm-12 col-md-12">
<?php echo __('firstname');?> <?php echo __('firstname');?>
<em>* </em> <em>* </em>
<?php echo $this->Form->input('UserPersonals.firstname_th', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $responseUserPersonal['firstname_th'], 'id' => 'firstname_th', 'type' => 'text', 'label' => false, 'placeholder' => 'firstname']); ?> <?php echo $this->Form->input('UserPersonals.firstname_th', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'value' => $responseUserPersonal['firstname_th'], 'id' => 'firstname_th', 'type' => 'text', 'label' => false, 'minlength' => '4', 'placeholder' => 'firstname']); ?>
<?php // echo $this->Form->input('fullname', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->firstname_th . ' ' . $userProfiles->lastname_th, 'id' => 'fullName', 'type' => 'text', 'label' => __('ชื่อ - นามสกุล'), 'placeholder' => 'ชื่อ - นามสกุล']); ?> <?php // echo $this->Form->input('fullname', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->firstname_th . ' ' . $userProfiles->lastname_th, 'id' => 'fullName', 'type' => 'text', 'label' => __('ชื่อ - นามสกุล'), 'placeholder' => 'ชื่อ - นามสกุล']); ?>
</div> </div>
</div> </div>
...@@ -73,7 +73,7 @@ use Cake\I18n\Time; ...@@ -73,7 +73,7 @@ use Cake\I18n\Time;
<div class="col-xs-12 col-sm-12 col-md-12"> <div class="col-xs-12 col-sm-12 col-md-12">
<?php echo __('lastname');?> <?php echo __('lastname');?>
<em>* </em> <em>* </em>
<?php echo $this->Form->input('UserPersonals.lastname_th', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $responseUserPersonal['lastname_th'], 'id' => 'lastname_th', 'type' => 'text', 'label' => false, 'placeholder' => 'lastname']); ?> <?php echo $this->Form->input('UserPersonals.lastname_th', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'value' => $responseUserPersonal['lastname_th'], 'id' => 'lastname_th', 'type' => 'text', 'label' => false, 'minlength' => '4', 'placeholder' => 'lastname']); ?>
<?php // echo $this->Form->input('fullname', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->firstname_th . ' ' . $userProfiles->lastname_th, 'id' => 'fullName', 'type' => 'text', 'label' => __('ชื่อ - นามสกุล'), 'placeholder' => 'ชื่อ - นามสกุล']); ?> <?php // echo $this->Form->input('fullname', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->firstname_th . ' ' . $userProfiles->lastname_th, 'id' => 'fullName', 'type' => 'text', 'label' => __('ชื่อ - นามสกุล'), 'placeholder' => 'ชื่อ - นามสกุล']); ?>
</div> </div>
</div> </div>
...@@ -81,7 +81,7 @@ use Cake\I18n\Time; ...@@ -81,7 +81,7 @@ use Cake\I18n\Time;
<div class="col-xs-12 col-sm-12 col-md-12"> <div class="col-xs-12 col-sm-12 col-md-12">
<?php echo __('birthdate');?> <?php echo __('birthdate');?>
<em>* </em> <em>* </em>
<?php echo $this->Form->input('UserPersonals.birthdate', ['class' => 'form-control-reg border-bottom-from', 'value' => $dateNow, 'id' => 'datepicker', 'type' => 'text', 'label' => false, 'placeholder' => 'DD-MM-YYYY','readonly'=>'readonly']); ?> <?php echo $this->Form->input('UserPersonals.birthdate', ['class' => 'form-control-reg border-bottom-from required datepicker', 'value' => $dateNow, 'id' => 'datepicker', 'type' => 'text', 'label' => false, 'placeholder' => 'DD-MM-YYYY','readonly'=>'readonly']); ?>
<span class="glyphicon glyphicon-calendar form-control-feedback datepicker"></span> <span class="glyphicon glyphicon-calendar form-control-feedback datepicker"></span>
</div> </div>
</div> </div>
...@@ -134,7 +134,7 @@ use Cake\I18n\Time; ...@@ -134,7 +134,7 @@ use Cake\I18n\Time;
<div class="col-xs-12 col-sm-12 col-md-12"> <div class="col-xs-12 col-sm-12 col-md-12">
<?php echo __('mobile');?> <?php echo __('mobile');?>
<em>* </em> <em>* </em>
<?php echo $this->Form->input('UserPersonals.moblie_no', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $responseUserPersonal['moblie_no'], 'id' => 'moblieNo', 'type' => 'text', 'label' => false, 'maxlength' => '10', 'placeholder' => 'mobile']); ?> <?php echo $this->Form->input('UserPersonals.moblie_no', ['class' => 'form-control-reg border-bottom-from label-text-sub required digits', 'value' => $responseUserPersonal['moblie_no'], 'id' => 'moblieNo', 'type' => 'text', 'label' => false, 'maxlength' => '10', 'minlength' => '10', 'placeholder' => 'mobile']); ?>
<?php // echo $this->Form->input('moblie_no', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->moblie_no, 'id' => 'moblieNo', 'type' => 'text', 'label' => __('เบอร์โทรศัพท์'), 'placeholder' => '000-000-0000']); ?> <?php // echo $this->Form->input('moblie_no', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->moblie_no, 'id' => 'moblieNo', 'type' => 'text', 'label' => __('เบอร์โทรศัพท์'), 'placeholder' => '000-000-0000']); ?>
</div> </div>
</div> </div>
...@@ -142,10 +142,10 @@ use Cake\I18n\Time; ...@@ -142,10 +142,10 @@ use Cake\I18n\Time;
<div class="col-xs-12 col-sm-12 col-md-12"> <div class="col-xs-12 col-sm-12 col-md-12">
<?php echo __('email');?> <?php echo __('email');?>
<em>* </em> <em>* </em>
<!-- <?php echo $this->Form->input('UserPersonals.email', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $responseUserPersonal['email'], 'id' => 'email', 'label' => false, 'placeholder' => 'mail@xxx.com']); ?> --> <?php echo $this->Form->input('UserPersonals.email', ['class' => 'form-control-reg border-bottom-from label-text-sub required email', 'value' => $responseUserPersonal['email'], 'id' => 'email', 'name' => 'email', 'label' => false, 'placeholder' => 'mail@xxx.com']); ?>
<?php // echo $this->Form->input('email', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->email, 'id' => 'email', 'type' => 'email', 'label' => __('Email'), 'placeholder' => 'mail@xxx.com']); ?> <?php // echo $this->Form->input('email', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->email, 'id' => 'email', 'type' => 'email', 'label' => __('Email'), 'placeholder' => 'mail@xxx.com']); ?>
<input type="text" name="email" id="email" value="<?php echo $responseUserPersonal['email'] ?>" placeholder="mail@xxx.com" <!-- <input type="text" name="email" id="email" value="<?php echo $responseUserPersonal['email'] ?>" placeholder="mail@xxx.com"
class="form-control-reg border-bottom-from"> class="form-control-reg border-bottom-from"> -->
</div> </div>
</div> </div>
<div class="form-group has-feedback"> <div class="form-group has-feedback">
...@@ -168,7 +168,7 @@ use Cake\I18n\Time; ...@@ -168,7 +168,7 @@ use Cake\I18n\Time;
'value' => $responseUserPersonal['master_country_id'], 'value' => $responseUserPersonal['master_country_id'],
'empty' => '---Select---', 'empty' => '---Select---',
'default' => !empty($responseUserPersonal['master_country_id'])? $responseUserPersonal['master_country_id']:'', 'default' => !empty($responseUserPersonal['master_country_id'])? $responseUserPersonal['master_country_id']:'',
'class' => 'form-control border-bottom-from label-text-sub require', 'class' => 'form-control border-bottom-from label-text-sub require required',
'style' => 'width:100%' 'style' => 'width:100%'
)); ));
?> ?>
...@@ -188,7 +188,7 @@ use Cake\I18n\Time; ...@@ -188,7 +188,7 @@ use Cake\I18n\Time;
'value' => $responseUserPersonal['master_province_id'], 'value' => $responseUserPersonal['master_province_id'],
'empty' => '---Select---', 'empty' => '---Select---',
'default' => !empty($responseUserPersonal['master_province_id'])? $responseUserPersonal['master_province_id']:'', 'default' => !empty($responseUserPersonal['master_province_id'])? $responseUserPersonal['master_province_id']:'',
'class' => 'form-control border-bottom-from label-text-sub require', 'class' => 'form-control border-bottom-from label-text-sub require required',
'style' => 'width:100%' 'style' => 'width:100%'
)); ));
?> ?>
...@@ -654,63 +654,63 @@ use Cake\I18n\Time; ...@@ -654,63 +654,63 @@ use Cake\I18n\Time;
owl.trigger('next.owl.carousel'); owl.trigger('next.owl.carousel');
}); });
function validateForm() { // function validateForm() {
var firstname_th = document.getElementById("firstname_th").value; // var firstname_th = document.getElementById("firstname_th").value;
if (firstname_th == null || firstname_th == "") { // if (firstname_th == null || firstname_th == "") {
alert("<?php echo __('Please enter your firstname.'); ?>"); // alert("<?php echo __('Please enter your firstname.'); ?>");
return false; // return false;
} // }
var lastname_th = document.getElementById("lastname_th").value; // var lastname_th = document.getElementById("lastname_th").value;
if (lastname_th == null || lastname_th == "") { // if (lastname_th == null || lastname_th == "") {
alert("<?php echo __('Please enter your lastname.'); ?>"); // alert("<?php echo __('Please enter your lastname.'); ?>");
return false; // return false;
} // }
var birthdate = document.getElementById("datepicker").value; // var birthdate = document.getElementById("datepicker").value;
if (birthdate == null || birthdate == "") { // if (birthdate == null || birthdate == "") {
alert("<?php echo __('Please enter your birthdate.'); ?>"); // alert("<?php echo __('Please enter your birthdate.'); ?>");
return false; // return false;
} // }
var moblieNo = document.getElementById("moblieNo").value; // var moblieNo = document.getElementById("moblieNo").value;
if (moblieNo == null || moblieNo == "") { // if (moblieNo == null || moblieNo == "") {
alert("<?php echo __('Please enter your mobile.'); ?>"); // alert("<?php echo __('Please enter your mobile.'); ?>");
return false; // return false;
} // }
if(document.getElementById("moblieNo").value.length != 10) // if(document.getElementById("moblieNo").value.length != 10)
{ // {
alert("<?php echo __('Please enter a 10 digit mobile number.'); ?>"); // alert("<?php echo __('Please enter a 10 digit mobile number.'); ?>");
return false; // return false;
} // }
var email = document.getElementById("email").value; // var email = document.getElementById("email").value;
if (email == null || email == "") { // if (email == null || email == "") {
alert("<?php echo __('Please enter your email address.'); ?>"); // alert("<?php echo __('Please enter your email address.'); ?>");
return false; // return false;
} // }
var email = $("#email").val(); // var email = $("#email").val();
if (/(.+)@(.+){2,}\.(.+){2,}/.test(email)) { } else { // if (/(.+)@(.+){2,}\.(.+){2,}/.test(email)) { } else {
alert("<?php echo __('Email address format wrong, Please enter the correct number.'); ?>"); // alert("<?php echo __('Email address format wrong, Please enter the correct number.'); ?>");
return false; // return false;
} // }
var master_country_id = document.getElementById("master_country_id").value; // var master_country_id = document.getElementById("master_country_id").value;
if (master_country_id == null || master_country_id == "") { // if (master_country_id == null || master_country_id == "") {
alert("<?php echo __('Please specify country') ?>"); // alert("<?php echo __('Please specify country') ?>");
return false; // return false;
} // }
var master_province_id = document.getElementById("master_province_id").value; // var master_province_id = document.getElementById("master_province_id").value;
if (master_province_id == null || master_province_id == "") { // if (master_province_id == null || master_province_id == "") {
alert("<?php echo __('Please specify province') ?>"); // alert("<?php echo __('Please specify province') ?>");
return false; // return false;
} // }
$("body").delegate(".is_active", "click", function () { // $("body").delegate(".is_active", "click", function () {
$('.is_active').not(this).prop('checked', false); // $('.is_active').not(this).prop('checked', false);
return true; // return true;
}); // });
} // }
$(function () { $(function () {
//================================================== //==================================================
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment