Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
smart_core_connect
/
core-connect
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f6d13942
authored
Jun 06, 2018
by
Teeradone Darunnat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
teeradone validate register
parent
27609774
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
85 deletions
+16
-85
www/src/Template/Layout/blank.ctp
+1
-1
www/src/Template/Users/signup.ctp
+6
-84
www/webroot/js/validate/jQuery.validate.addValidate.js
+9
-0
No files found.
www/src/Template/Layout/blank.ctp
View file @
f6d13942
...
@@ -95,8 +95,8 @@
...
@@ -95,8 +95,8 @@
<?php echo $this->Html->script('/js/magnific-popup/jquery.magnific-popup.min'); ?>
<?php echo $this->Html->script('/js/magnific-popup/jquery.magnific-popup.min'); ?>
<?php echo $this->Html->script('/js/vide/vide.min'); ?>
<?php echo $this->Html->script('/js/vide/vide.min'); ?>
<?php echo $this->Html->script('/js/validate/jQuery.start.min'); ?>
<?php echo $this->Html->script('/js/validate/jQuery.start.min'); ?>
<?php echo $this->Html->script('/js/validate/jQuery.validate.addValidate'); ?>
<?php echo $this->Html->script('/js/validate/jQuery.validate.min'); ?>
<?php echo $this->Html->script('/js/validate/jQuery.validate.min'); ?>
<?php echo $this->Html->script('/js/validate/jQuery.validate.addValidate'); ?>
<!-- Theme Base, Components and Settings -->
<!-- Theme Base, Components and Settings -->
<?php echo $this->Html->script('theme'); ?>
<?php echo $this->Html->script('theme'); ?>
<!-- Theme Custom -->
<!-- Theme Custom -->
...
...
www/src/Template/Users/signup.ctp
View file @
f6d13942
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
<div class="form-group has-feedback">
<div class="form-group has-feedback">
<div class="col-md-12">
<div class="col-md-12">
<label class="label-text-sub"><?php echo __('Firstname');?><em>* </em></label>
<label class="label-text-sub"><?php echo __('Firstname');?><em>* </em></label>
<input type="text" name="firstname" id="firstname" value="" placeholder="FIRSTNAME" class="form-control-reg border-bottom-from required letter
s
">
<input type="text" name="firstname" id="firstname" value="" placeholder="FIRSTNAME" class="form-control-reg border-bottom-from required letter
thai
">
</div>
</div>
</div>
</div>
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
<div class="form-group has-feedback">
<div class="form-group has-feedback">
<div class="col-md-12">
<div class="col-md-12">
<label class="label-text-sub"><?php echo __('Lastname');?><em>* </em></label>
<label class="label-text-sub"><?php echo __('Lastname');?><em>* </em></label>
<input type="text" name="lastname" id="lastname" value="" placeholder="LASTNAME" class="form-control-reg border-bottom-from required">
<input type="text" name="lastname" id="lastname" value="" placeholder="LASTNAME" class="form-control-reg border-bottom-from required
letterthai
">
</div>
</div>
</div>
</div>
...
@@ -82,7 +82,7 @@
...
@@ -82,7 +82,7 @@
<div class="form-group has-feedback bootstrap-iso">
<div class="form-group has-feedback bootstrap-iso">
<div class="col-md-12">
<div class="col-md-12">
<label class="label-text-sub"><?php echo __('Birthdate');?></label>
<label class="label-text-sub"><?php echo __('Birthdate');?></label>
<input type="text" name="birthdate" id="date" placeholder="กรุณาระบุวันเดือนปีเกิด" value="" placeholder="DD-MM-YYYY" data-date-format="mm/dd/yyyy" class="form-control-reg border-bottom-from required date
picker
" readonly>
<input type="text" name="birthdate" id="date" placeholder="กรุณาระบุวันเดือนปีเกิด" value="" placeholder="DD-MM-YYYY" data-date-format="mm/dd/yyyy" class="form-control-reg border-bottom-from required date" readonly>
<span class="glyphicon glyphicon-calendar form-control-feedback"></span>
<span class="glyphicon glyphicon-calendar form-control-feedback"></span>
</div>
</div>
</div>
</div>
...
@@ -100,7 +100,7 @@
...
@@ -100,7 +100,7 @@
<div class="form-group has-feedback">
<div class="form-group has-feedback">
<div class="col-md-12">
<div class="col-md-12">
<label class="label-text-sub"><?php echo __('Email');?><em>* </em></label>
<label class="label-text-sub"><?php echo __('Email');?><em>* </em></label>
<input type="text" name="email" id="fremail" value="" placeholder="mail@xxx.com" class="form-control-reg border-bottom-from required email
small_letters
">
<input type="text" name="email" id="fremail" value="" placeholder="mail@xxx.com" class="form-control-reg border-bottom-from required email
emailtext
">
</div>
</div>
</div>
</div>
...
@@ -109,7 +109,7 @@
...
@@ -109,7 +109,7 @@
<div class="form-group has-feedback">
<div class="form-group has-feedback">
<div class="col-md-12">
<div class="col-md-12">
<label class="label-text-sub"><?php echo __('Password');?><em>* </em></label>
<label class="label-text-sub"><?php echo __('Password');?><em>* </em></label>
<input data-toggle="password" data-placement="before" type="password" name="password" id="password" value="" placeholder="********" class="form-control input-lg color-button-border border-bottom-from required" style="padding:0px 0px !important;" minlength=8>
<input data-toggle="password" data-placement="before" type="password" name="password" id="password" value="" placeholder="********" class="form-control input-lg color-button-border border-bottom-from required
alphanumeric
" style="padding:0px 0px !important;" minlength=8>
<!--<input type="password" name="data[password]" id="password" value="" placeholder="********" class="form-control-reg border-bottom-from" onkeyup='check();'>-->
<!--<input type="password" name="data[password]" id="password" value="" placeholder="********" class="form-control-reg border-bottom-from" onkeyup='check();'>-->
<!--<span class="glyphicon glyphicon-eye-close form-control-feedback"></span>-->
<!--<span class="glyphicon glyphicon-eye-close form-control-feedback"></span>-->
</div>
</div>
...
@@ -119,7 +119,7 @@
...
@@ -119,7 +119,7 @@
<div class="form-group has-feedback">
<div class="form-group has-feedback">
<div class="col-md-12">
<div class="col-md-12">
<label class="label-text-sub"><?php echo __('Confirm password');?><em>* </em></label>
<label class="label-text-sub"><?php echo __('Confirm password');?><em>* </em></label>
<input data-toggle="password" data-placement="before" type="password" name="confirm_password" id="confirm_password" value="" placeholder="********" class="form-control input-lg color-button-border border-bottom-from required" style="padding:0px 0px !important;" minlength=8>
<input data-toggle="password" data-placement="before" type="password" name="confirm_password" id="confirm_password" value="" placeholder="********" class="form-control input-lg color-button-border border-bottom-from required
alphanumeric
" style="padding:0px 0px !important;" minlength=8>
<!--<input type="password" id="confirm_password" name="data[confirm_password]" value="" placeholder="********" class="form-control-reg border-bottom-from" onkeyup='check();'>-->
<!--<input type="password" id="confirm_password" name="data[confirm_password]" value="" placeholder="********" class="form-control-reg border-bottom-from" onkeyup='check();'>-->
<!--<span class="glyphicon glyphicon-eye-close form-control-feedback" id='message'></span>-->
<!--<span class="glyphicon glyphicon-eye-close form-control-feedback" id='message'></span>-->
<span id='message'></span>
<span id='message'></span>
...
@@ -166,84 +166,6 @@
...
@@ -166,84 +166,6 @@
<!-- ------------------------------- popup ----------------------------------- -->
<!-- ------------------------------- popup ----------------------------------- -->
<script>
<script>
$(document).ready(function() {
$("#username").on('change',function(){
var elem = document.getElementById('username').value;
// console.log(elem);
if(!elem.match(/^([A-Za-z0-9])+$/i)){
alert("<?php echo __('Please enter only text in English or numbers.');?>");
return false;
}
})
$("#firstname").on('change',function(){
var elem = document.getElementById('firstname').value;
// console.log(elem);
if(!elem.match(/^([A-Za-z0-9ก-๙])+$/i)){
alert("<?php echo __('Please enter text in English, Thai or only.');?>");
return false;
}
})
$("#lastname").on('change',function(){
var elem = document.getElementById('lastname').value;
// console.log(elem);
if(!elem.match(/^([A-Za-z0-9ก-๙])+$/i)){
alert("<?php echo __('Please enter text in English, Thai or only.');?>");
return false;
}
})
$("#password").on('change',function(){
var elem = document.getElementById('password').value;
// console.log(elem);
if(!elem.match(/^([A-Za-z0-9])+$/i)){
alert("<?php echo __('Please enter only text in English or numbers.');?>");
return false;
}
})
$("#confirm_password").on('change',function(){
var elem = document.getElementById('confirm_password').value;
// console.log(elem);
if(!elem.match(/^([A-Za-z0-9])+$/i)){
alert("<?php echo __('Please enter only text in English or numbers.');?>");
return false;
}
})
$("#fremail").on('change',function(){
var elem = document.getElementById('fremail').value;
console.log(elem);
if(!elem.match(/^([A-Za-z0-9@._])+$/i)){
alert("<?php echo __('Wrong email address format Please enter the correct number.');?>");
return false;
}
})
$("#fremail").on('change',function(){
var email = document.getElementById("fremail").value;
$.post("/Checkemails/checkemail", {email: email}, function(data) {
// console.log(data);
data = jQuery.parseJSON(data);
if(data['chk'] == 'false'){
alert("<?php echo __('This email is already in the system.');?>");
return false;
}
});
});
});
// function check_phone() {
// e_k=event.keyCode
// // if (((e_k < 48) || (e_k > 57)) && e_k != 46 ) {
// if (e_k = 10 && (e_k < 48) || (e_k > 59)) {
// event.returnValue = false;
// alert("<?php echo __('Please enter the phone number. Only numbers.');?>");
// }
// }
function validateForm() {
function validateForm() {
var password = document.getElementById("password").value;
var password = document.getElementById("password").value;
var confirm_password = document.getElementById("confirm_password").value;
var confirm_password = document.getElementById("confirm_password").value;
...
...
www/webroot/js/validate/jQuery.validate.addValidate.js
View file @
f6d13942
...
@@ -26,6 +26,15 @@
...
@@ -26,6 +26,15 @@
| 19. ckquarter-min ,Example 'ckquarter-min' = '2'
| 19. ckquarter-min ,Example 'ckquarter-min' = '2'
| ------------------------------------------------------------------------------------------------------------------
| ------------------------------------------------------------------------------------------------------------------
*/
*/
jQuery
.
validator
.
addMethod
(
"emailtext"
,
function
(
value
,
element
)
{
return
this
.
optional
(
element
)
||
/^
([
a-zA-Z@_.
])
+$/
.
test
(
value
);
},
"โปรดระบุที่อยู่อีเมล์ที่ถูกต้อง."
);
jQuery
.
validator
.
addMethod
(
"letterthai"
,
function
(
value
,
element
)
{
return
this
.
optional
(
element
)
||
/^
([
a-zA-Zก-๙
])
+$/
.
test
(
value
);
},
"เฉพาะตัวอักษรเท่านั้น."
);
jQuery
.
validator
.
addMethod
(
"letterthai"
,
function
(
value
,
element
)
{
return
this
.
optional
(
element
)
||
/^
([
a-zA-Zก-๙
])
+$/
.
test
(
value
);
},
"เฉพาะตัวอักษรเท่านั้น."
);
jQuery
.
validator
.
addMethod
(
"letters"
,
function
(
value
,
element
)
{
jQuery
.
validator
.
addMethod
(
"letters"
,
function
(
value
,
element
)
{
return
this
.
optional
(
element
)
||
/^
[
a-zA-Z
]
+$/i
.
test
(
value
);
return
this
.
optional
(
element
)
||
/^
[
a-zA-Z
]
+$/i
.
test
(
value
);
},
"เฉพาะตัวอักษรเท่านั้น."
);
},
"เฉพาะตัวอักษรเท่านั้น."
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment