Skip to content

Commit 3ef109f

Browse files
Merge pull request #2 from natalialuzuriaga/nat/styling
Added heading to form to add more context
2 parents d279eb3 + 0d9413b commit 3ef109f

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

form.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
<script src="https://unpkg.com/formiojs@3.0.0-alpha.13/dist/formio.full.min.js"></script>
2828
</head>
2929
<body>
30+
<div id="form-header"></div>
3031
<div id="formio"></div>
3132
<script src="js/generateFormComponents.js"></script>
3233
<script src="js/formDataToJson.js"></script>

js/generateFormComponents.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ function createComponent(fieldName, fieldObject) {
115115
}
116116
}
117117

118+
function createFormHeading(title, description) {
119+
const container = document.getElementById('form-header');
120+
container.innerHTML = `<h1>${title}</h1>\n<h2>${description}</h2>`;
121+
}
122+
118123
// Iterates through each json field and creates component array for Form.io
119124
async function createFormComponents() {
120125
let components = [];
@@ -124,6 +129,8 @@ async function createFormComponents() {
124129
let jsonData = await retrieveFile(filePath);
125130
console.log("JSON Data:", jsonData);
126131

132+
createFormHeading(jsonData["title"], jsonData["description"]);
133+
127134
formFields = jsonData["properties"];
128135
console.log("form Fields:", formFields);
129136

0 commit comments

Comments
 (0)