|
|
|
สอบถามปัญหา ใช้ bootstrap validator รันบน localhost ได้ แต่รันบน server จริงไม่ได้ มีแนวทางแก้ไขอย่างไรบ้างไหมคะ |
|
|
|
|
|
|
|
code ที่ใช้นะคะ
ส่วนใหญ่ bootstrap ต่างๆจะใช้ลิงก์โหลดจากข้างนอกเข้ามาค่ะ
ตอนอัพขึ้น host ก็ copy ไฟล์ทั้งหมดในโฟลเดอร์เข้าไปหมดด้วยค่ะ
Code (PHP)
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<!-- Website CSS style -->
<link rel="stylesheet" type="text/css" href="css/main.css">
<!-- Website Font style -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css">
<!-- Google Fonts -->
<link href='https://fonts.googleapis.com/css?family=Passion+One' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Oxygen' rel='stylesheet' type='text/css'>
<title>Login Form</title>
<!-- reference: http://stackoverflow.com/questions/24072896/bootstrap-validator-no-validation-is-actually-happening -->
<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script type="text/javascript" src="js/bootstrap.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/jquery.bootstrapvalidator/0.5.0/css/bootstrapValidator.min.css"/>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery.bootstrapvalidator/0.5.0/js/bootstrapValidator.min.js"> </script>
<!--icon: http://getbootstrap.com/components/-->
<script>
$(document).ready(function() {
$('#registerform').bootstrapValidator({
framework: 'bootstrap',
//live: 'enabled',
message: 'This value is not valid',
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
username: {
message: 'The username is not valid',
validators: {
notEmpty: {
message: 'The username is required and cannot be empty'
},
stringLength: {
min: 6,
max: 30,
message: 'The username must be more than 6 and less than 30 characters long'
},
regexp: {
regexp: /^[a-zA-Z0-9_]+$/,
message: 'The username can only consist of alphabetical, number and underscore'
}
}
},
password: {
message: 'The password is not valid',
validators: {
notEmpty: {
message: 'The password is required and cannot be empty'
},
stringLength: {
min: 6,
max: 30,
message: 'The password must be more than 6 and less than 30 characters long'
},
regexp: {
regexp: /^[a-zA-Z0-9_]+$/,
message: 'The password can only consist of alphabetical, number and underscore'
}
}
},
}
});
});
</script>
</head>
<body>
<div class="container">
<div class="row main">
<div class="panel-heading">
<div class="panel-title text-center">
<h1 class="title">LOGIN</h1>
<hr />
</div>
</div>
<div class="main-login main-center">
<form id="registerform" class="form-horizontal" method="post" action="real_check_login.php">
<div class="form-group">
<label for="username" class="cols-sm-2 control-label">Username</label>
<div class="cols-sm-10">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-user fa" aria-hidden="true"></i></span>
<input type="text" class="form-control" name="username" id="username" placeholder="Enter your Username"/>
</div>
</div>
</div>
<div class="form-group">
<label for="password" class="cols-sm-2 control-label">Password</label>
<div class="cols-sm-10">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-lock fa-lg" aria-hidden="true"></i></span>
<input type="password" class="form-control" name="password" id="password" placeholder="Enter your Password"/>
</div>
</div>
</div>
<div class="form-group ">
<button type="submit" class="btn btn-primary btn-lg btn-block login-button">Login</button>
</div>
<div class="login-register">
<a href="real_register.php">Register</a>
</div>
</form>
</div>
<!--Credit Create by group-->
<div>
<div class="text-center">
<br>
© FST GROUP
</div></div>
</div>
</div>
</body>
</html>
|
|
|
|
|
Date :
2017-04-05 21:02:42 |
By :
nayama |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
กด F12 ดู console.log ตรวจสอบ error ตามนั้น
|
|
|
|
|
Date :
2017-04-07 08:23:59 |
By :
fossil31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|