I am trying to recreate a form that was written with the deprecated UiApp into an HtmlService version. I inherited most of this code so I am trying to learn/improve/tidy as I go.
The old form looks like this, with a label above each input box:
The best I can get the new form to look like is like this, with labels in line with inputs:
The code I have so far is:
<!--this line was missing-->
<?!=HtmlService.createHtmlOutputFromFile('Stylesheet').getContent();?>
<!--and including it fixes part two of my questions-->
<html>
<body>
<h3>ProReactive Hazard Logging v3.0.0</h3>
<form action="<?= action ?>" method="post">
Date:<input type="date" name="date" style="width: 100px;">
Depot/Site:<input list="depot" name="depot" style="width: 100px;">
<datalist id="depot">
<option value="COMPANY (H&S Projects Team">
<option value="CS - C** Street Depot">
</datalist>
Reporter:<input type="text" name="reporter" style="width: 100px;"/>
Contact No:<input type="text" name="details" style="width: 100px;"/>
Source Code:<input list="source" name="source" style="width: 100px;">
<datalist id="source">
<option value="01 - Accident/Incident investigations & reports">
<option value="02 - Company or location H&S Committee / Forum actions">
<option value="03 - Emergency Preparedness reviews/activities">
</datalist>
Hazard Code:<input list="hazard" name="hazard" style="width: 100px;">
<datalist id="hazard">
<option value="01 - Access equipment fault">
<option value="02 - Assault - verbal/physical">
<option value="03 - Blocked/held open fire route/exit">
<option value="04 - Contractor / visitor non-compliance or poor/unsafe practice">
</datalist>
Brief Details:<input type="text" name="details" />
Full Description:<input type="text" name="description" />
Priority Code:<input list="priority" name="priority">
<datalist id="priority">
<option value="02 - WITHIN 24-48 HOURS">
<option value="03 - WITHIN 1 WEEK">
<option value="04 - WITHIN 1 MONTH">
<option value="05 - WITHIN 3 MONTHS">
<option value="06 - FOR MANAGEMENT DISCUSSION">
</datalist>
</form>
<input type="submit" value="SUBMIT" />
</form>
</body>
</html>
So my questions are:
How do I get the entry box titles to be headers like the old form? This is so I can add the "add/remove row" buttons and it all lines up as the form is used to enter multiple items at each use.
How do I move the 'style="width: ***px;"' to a CSS sheet to improve the code? The text input boxes need to be different sizes (e.g. the 'contact no' entry is an phone ext. so only needs to be small, the others the same & the details/description boxes double line height)
As per request from mogsdad, here is the stylesheet contents:
<form>
<style>
h3 {font-size: 20px;}
h4 {font-size: 14px;
font-weight: bold;}
.mydatepick {
width: 150px;}
.mylistbox {
width: 200px;}
.result-display {
margin-left: 5px;
font-size: 100%;}
.mytextbox{
width: 150px;}
.myparagraphbox{
width: 150px;
height: 70px;}
.error {
color: #FF0000;}
.hidden {
display: none;}
.button-success {
color: white;
border-radius: 4px;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
background: rgb(28, 184, 65); /* this is a green */}
.button-error {
color: white;
border-radius: 4px;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
background: rgb(202, 60, 60); /* this is a maroon */}
</style>
</form>