nos-forms-jquery
Version:
Build and validate DRY html forms in minutes with JSON, jQuery and Bootstrap
74 lines (53 loc) • 2.3 kB
HTML
<html lang="en">
<head>
<title>Nos-Forms jQuery</title>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="/nosform-jquery.css">
</head>
<body>
<div class="container">
<form id="myform" action="./test" method="POST"></form>
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script src="/nosform-jquery.js"></script>
<!--<script src="//cdnjs.cloudflare.com/ajax/libs/jquery.maskedinput/1.4.1/jquery.maskedinput.min.js"></script>-->
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery.mask/1.14.10/jquery.mask.min.js"></script>
<script src="//localhost:35729/livereload.js"></script>
<script>
$(function() {
$.get('login-form.json', function (data) {
var form = $("#myform").nosForm({
fields: data,
animationSpeed: 50,
validate: true,
ajax: true,
htmlValidation: false,
honeypot: true,
messages: {
required: 'Oops! You missed something!',
invalid: 'Invalid entry'
},
messageLocation: {
top: false,
bottom: true
},
submit: function (formdata, form, evt) {
console.log('regular submit');
// console.log(formdata);
// console.log(form);
// console.log(evt);
},
// init: function (form) {
// // console.log(form);
// },
onlySubmitWithValue: true
})
.on('nos.submit', function (e, data) {
console.log(data.formdata);
});
});
});
</script>
</body>
</html>