| Server IP : 172.67.216.113 / Your IP : 172.71.28.146 [ 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/plugin/bootstrapvalidator-master/demo/ |
Upload File : |
<!DOCTYPE html>
<html>
<head>
<title>BootstrapValidator demo</title>
<link rel="stylesheet" href="../vendor/bootstrap/css/bootstrap.css"/>
<link rel="stylesheet" href="../dist/css/bootstrapValidator.css"/>
<script type="text/javascript" src="../vendor/jquery/jquery.min.js"></script>
<script type="text/javascript" src="../vendor/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../dist/js/bootstrapValidator.js"></script>
</head>
<body>
<div class="container">
<div class="row">
<section>
<div class="col-lg-8 col-lg-offset-2">
<div class="page-header">
<h2><code>selector</code> example</h2>
</div>
<form id="sumForm" method="post" class="form-horizontal" action="target.php">
<div class="form-group">
<label class="col-lg-3 control-label">Percentage</label>
<div class="col-lg-5">
<input class="form-control percent" name="first" type="text" value="0" />
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-3 col-lg-5">
<input class="form-control percent" name="second" type="text" value="0" />
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-3 col-lg-5">
<input class="form-control percent" name="third" type="text" value="0" />
</div>
</div>
<div class="form-group">
<div class="col-lg-9 col-lg-offset-3">
<button type="submit" class="btn btn-primary">Validate</button>
</div>
</div>
</form>
</div>
</section>
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
$('#sumForm')
.bootstrapValidator({
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
percentage: {
selector: '.percent',
validators: {
notEmpty: {
message: 'The percentage is required'
},
callback: {
message: 'The sum must be 100',
callback: function(value, validator) {
var percentage = validator.getFieldElements('percentage'),
length = percentage.length,
sum = 0;
for (var i = 0; i < length; i++) {
sum += parseFloat($(percentage[i]).val());
}
if (sum == 100) {
validator.updateStatus('percentage', 'VALID', 'callback');
return true;
}
return false;
}
}
}
}
}
});
});
</script>
</body>
</html>