I want to create a form like the attached image. So far, here is my progress.
function gotoTask() {
var message = document.getElementById("goto").value;
goto_message.innerHTML = message;
}
function waitTask() {
var message = document.getElementById("wait").value;
wait_message.innerHTML = message;
}
body {
display: flex;
flex-direction: column;
align-items: center;
padding: 50px;
}
div.input_fields {
width: 50%;
display: flex;
justify-content: space-between;
align-items: center;
border: 1px solid #17375e;
border-radius: 15px;
padding: 10px 15px;
margin-bottom: 10px;
}
.task_window {
width: 50%
display: flex;
justify-content: space-between;
border: 1px solid #17375e;
border-radius: 15px;
padding: 10px 15px;
}
select {
padding: 3px 5px;
border-radius: 10px;
margin-right: 10px;
}
button {
background-color: #17375e;
color: #fff;
padding: 5px 15px;
border: 0px;
border-radius: 10px;
}
<body>
<div class="input_fields">
<label for="goto">Go to</label>
<select id="goto">
<option value="Place 1">Place 1</option>
<option value="Place 2">Place 2</option>
<option value="Place 3">Place 3</option>
<option value="Place 4">Place 4</option>
</select>
<button type="button" onclick="gotoTask()">OK</button>
</div>
<div class="input_fields">
<label for="wait">Wait for</label>
<select id="wait">
<option value="Place 1">Place 1</option>
<option value="Place 2">Place 2</option>
<option value="Place 3">Place 3</option>
<option value="Place 4">Place 4</option>
</select>
<button type="button" onclick="waitTask()">OK</button>
</div>
<div class="task_window">
Task: <span id="goto_message"></span> <span id="wait_message"></span>
<button type="submit" onclick="pushTask()">OK</button>
</div>
</body>
Basically it has several option inputs and each input have its own submit button which when clicked shows the selected option at the bottom of the page. My question is do I have to create a number of forms to make this happen or I can do this within one single form? Or is there any other way to do this altogether?
