javascript - Issue with JsonForm in mvc -
i trying use jsonform libary github generate html markup json schema. trying in mvc view not have default form tag. added 1 html.beginform still markup not generated , following javascript error in console :typeerror: _ null . me out ?
below code in view :
@{ viewbag.title = "index"; layout = "~/views/shared/_layout.cshtml"; } @using (html.beginform()) { <script type="text/javascript" src="~/scripts/jquery-1.8.2.js"></script> <script type="text/javascript" src="~/scripts/json-form.js"></script> <script type="text/javascript" src="~/scripts/bootstrap.min.js"></script> <script type="text/javascript" src="~/scripts/underscore.js"></script> <link href="~/content/bootstrap.css" rel="stylesheet" /> <script type="text/javascript"> $('form').jsonform({ schema: { name: { type: 'string', title: 'name', required: true }, age: { type: 'number', title: 'age' } }, onsubmit: function (errors, values) { if (errors) { } else { } } }) $(document).ready(function () { alert('udayan'); }); </script> <h2>index</h2> }
json-form.js depends upon underscore (_
). therefore need move:
<script type="text/javascript" src="~/scripts/underscore.js"></script>
... above:
<script type="text/javascript" src="~/scripts/json-form.js"></script>
Comments
Post a Comment