Last active
August 29, 2015 14:02
-
-
Save Gounlaf/8eae9c39cfc3f1117d26 to your computer and use it in GitHub Desktop.
bootstrapvalidator doesn't work if form submit input/button name is "submit"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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" /> | |
</head> | |
<body> | |
<?php if(!empty($_POST)) { var_dump($_POST); } ?> | |
<div class="container"> | |
<div class="row"> | |
<section> | |
<div class="col-lg-8 col-lg-offset-2"> | |
<div class="page-header"> | |
<h2>Sign up</h2> | |
</div> | |
<form id="test" method="post" class="form-horizontal" action="index.php"> | |
<div class="form-group"> | |
<label class="col-lg-3 control-label">Email address</label> | |
<div class="col-lg-5"> | |
<input class="form-control" name="email" type="email" /> | |
</div> | |
</div> | |
<div class="form-group"> | |
<button type="submit" class="btn btn-primary" name="test-button">Will work</button> | |
</div> | |
</form> | |
<form id="test2" method="post" class="form-horizontal" action="index.php"> | |
<div class="form-group"> | |
<label class="col-lg-3 control-label">Email address</label> | |
<div class="col-lg-5"> | |
<input class="form-control" name="email" type="email" /> | |
</div> | |
</div> | |
<div class="form-group"> | |
<button type="submit" class="btn btn-primary" name="submit">Will not work</button> | |
</div> | |
</form> | |
<form id="test3" method="post" class="form-horizontal" action="index.php"> | |
<div class="form-group"> | |
<label class="col-lg-3 control-label">Email address</label> | |
<div class="col-lg-5"> | |
<input class="form-control" name="email" type="email" /> | |
</div> | |
</div> | |
<div class="form-group"> | |
<button type="submit" class="btn btn-primary" id="submit" name="test-button">Will not work too</button> | |
</div> | |
</form> | |
</div> | |
</section> | |
</div> | |
</div> | |
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.0.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> | |
<script type="text/javascript"> | |
$(document).ready(function () { | |
$('#test').bootstrapValidator({ | |
feedbackIcons: { | |
valid: 'glyphicon glyphicon-ok', | |
invalid: 'glyphicon glyphicon-remove', | |
validating: 'glyphicon glyphicon-refresh' | |
} | |
}); | |
$('#test2').bootstrapValidator({ | |
feedbackIcons: { | |
valid: 'glyphicon glyphicon-ok', | |
invalid: 'glyphicon glyphicon-remove', | |
validating: 'glyphicon glyphicon-refresh' | |
} | |
}); | |
$('#test3').bootstrapValidator({ | |
feedbackIcons: { | |
valid: 'glyphicon glyphicon-ok', | |
invalid: 'glyphicon glyphicon-remove', | |
validating: 'glyphicon glyphicon-refresh' | |
} | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment