renaldyks
renaldyks

Reputation: 188

Value iteration in HTML

Description

I want to make this view work, enter image description here

I'm using a loop for this table, I managed to do a loop for the input part of the id. enter image description here

The input id has followed the increment according to the number of iterations

Problem

However, I also want variables like input id to apply in the value input.

Ex,

Iteration 1 > <input id="id-sensor-1" type="text" value="{{ variable-loopindex1 }}">

Iteration 2 > <input id="id-sensor-2" type="text" value="{{ variable-loopindex2 }}">

Iteration 3 > <input id="id-sensor-3" type="text" value="{{ variable-loopindex3 }}">

I'm using Python Flask and HTML Template. How do I get the conditions I want to work? Or is there any other solution? I'm at a loss to search for the keywords. Thanks

Upvotes: 0

Views: 53

Answers (1)

maya
maya

Reputation: 1080

Store variables in an iterable object, such as variables:

{% for variable in variables %}
    <input id="id-sensor-{{loop.index0}}" type="text" value="{{ variable }}">
{% endfor %}

Upvotes: 1

Related Questions