This repository has been archived by the owner on Aug 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
new.html
67 lines (61 loc) · 1.95 KB
/
new.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
---
excerpt: none
---
{% include head.html %}
<link href="{{site.baseurl}}/stylesheets/form.css" type="text/css" rel="stylesheet" />
<body class="no-js layout-claims layout-claims-new">
<a class="a-skip-to-main" href="#main">Skip to main content</a>
{% include site-header.html %}
<main role="main" id="main" class="page">
<div class="wrapper">
<h1>File a claim</h1>
<form id="claim"></form>
<div id="form-errors"></div>
</div>
</main>
{% include site-footer.html %}
</body>
<script type="text/javascript" src="{{site.baseurl}}/javascripts/underscore.js"></script>
<script type="text/javascript" src="{{site.baseurl}}/javascripts/jsonform.js"></script>
<script>
// Get the JSON Schema and form definitions
//var json_form = $.get("/javascripts/form.json");
var json_schema = $.get("{{site.baseurl}}/javascripts/schema.json");
// When the schema is available, render the form
$.when(json_schema).done(function() {
$('#claim').jsonForm({
"schema": json_schema.responseJSON,
"form": [
{
"key": "information"
},
{
"key": "claimant"
},
{
"key": "employment",
"description": "Benefit eligibility is primarily determined by the claimant’s employment history. Please provide information about the claimant’s current employment."
},
{
"key": "dependent"
},
{
"type": "button",
"title": "Submit"
}
],
onSubmit: function (errors, values) {
if (errors) {
$('.form-errors').html('<p>Please fix the below errors.</p>');
}
else {
$('.form-errors').html('<p>Hello ' + values.name + '.' +
(values.age ? '<br/>You are ' + values.age + '.' : '') +
'</p>');
}
}
});
}).fail(function() {
console.log('Schema could not be retrieved');
});
</script>