I have a multi-step form and on the final page, I want to display all of the user's inputs from the previous pages (before clicking the "submit" button). How can I do this with JavaScript? I've tried the following, but the input values on the final page still show up as blank.
HTML/JS
{% extends 'layout.html' %}
{% block body %}
<form method="POST" id="regForm" action="{{ url_for('pipeline') }}">
<div class="tab">
<label>Start Point</label>
{{ form.start_point(placeholder="Start point..", oninput="this.className = ''") }}
<label>QC</label>
{{ form.qc(placeholder="QC...", oninput="this.className = ''") }}
</div>
<div class="tab">
<label>Input S3 Bucket</label>
{{ form.input_uri(placeholder="(e.g. s3://pipeline-run/fastqs/)...", oninput="this.className = ''") }}
<label>Output S3 Bucket</label>
{{ form.output_uri(placeholder="(e.g. s3://pipeline-run/results/)...", oninput="this.className = ''") }}
</div>
<!-- Review page where I want all the input values to be displayed -->
<div class="tab">
<h3>Review</h3>
<label>Start Point: <span id="start_point_label">{{ START_POINT }}</span></label>
<label>QC: <span id="qc_label">{{ QC }}</span></label>
<label>Input S3 Bucket: <span id="input_uri_label">{{ INPUT_URI }}</span></label>
<label>Output S3 Bucket: <span id="output_uri_label">{{ OUTPUT_URI }}</span></label>
</div>
</form>
<script>
$(function() {
$('#start_point').change(function(){
$(#'start_point_label').text($(this).val());
});
$('#qc').change(function(){
$(#'qc_label').text($(this).val());
});
$('#input_uri').change(function(){
$(#'input_uri_label').text($(this).val());
});
$('#output_uri').change(function(){
$(#'output_uri_label').text($(this).val());
});
});
</script>
{% endblock %}
UPDATE 1
i) Updated the inputs to have an id
:
<div class="tab">
<label>Start Point</label>
{{ form.start_point(placeholder="Start point..", oninput="this.className = ''", id="start_point") }}
<label>QC</label>
{{ form.qc(placeholder="QC...", oninput="this.className = ''", id="qc") }}
</div>
<div class="tab">
<label>Input S3 Bucket</label>
{{ form.input_uri(placeholder="(e.g. s3://pipeline-run/fastqs/)...", oninput="this.className = ''", id="input_uri") }}
<label>Output S3 Bucket</label>
{{ form.output_uri(placeholder="(e.g. s3://pipeline-run/results/)...", oninput="this.className = ''", id="output_uri") }}
</div>
ii) Updated the JS to put the #
inside the quotes
<script>
$(function() {
$('#start_point').change(function(){
$('#start_point_label').text($(this).val());
});
$('#qc').change(function(){
$('#qc_label').text($(this).val());
});
$('#input_uri').change(function(){
$('#input_uri_label').text($(this).val());
});
$('#output_uri').change(function(){
$('#output_uri_label').text($(this).val());
});
});
</script>