Good day!
There is a html document with a macro that displays input fields:
{% macro render_field(field) %} <p> <b>{{ field.label }}</b><br> {{ field(**kwargs)|safe }} {% if field.errors %} <ul> {% for error in field.errors %} <li style="color:red;">{{ error }}</li> {% endfor %} </ul> {% endif %} <p> {% endmacro %} <html> <body> <title>Guest Book</title> <form method="POST"> {{ render_field(form.test_name) }} {{ render_field(form.test_email) }} {{ render_field(form.test_comment) }} {{ render_field(form.test_phone) }} <button type="submit" class="btn btn-success">Send my comment</button> <br></br> <table border="1"> <tr> <th width="50">Date</th> <th width="70">Name</th> <th width="50">Email</th> <th width="50">Phone</th> <th width="100">Comment</th> <th width="50">Actions</th> </tr> {% for record in record %} <tr><td>{{ record.date.strftime("%Y-%m-%d %H:%M") }}</td><td>{{ record.name}}</td><td>{{ record.email}}</td> <td>{{ record.phone}}</td><td>{{ record.comment}}</td><td><a href='{{url_for('delete', record_id = record.id) }}'>Delete</a> </td></tr>{% endfor %} </table> </form> </body> </html> Help arrange different states for input fields. those. when valid information is entered, the frame glows green, if it is not valid, red
<div class="form-group has-success"> <label class="control-label" for="succ">ΠΡΠΎΡΠΌΠ»Π΅Π½ΠΈΠ΅ success</label> <input type="text" class="form-control"> </div> <div class="form-group has-error"> <label class="control-label" for="err">ΠΡΠΎΡΠΌΠ»Π΅Π½ΠΈΠ΅ error</label> <input type="text" class="form-control"> </div> Π― ΠΌΠΎΠ³ Π±Ρ ΡΠΏΡΠ°Π²ΠΈΡΡΡ ΠΈ ΡΠ°ΠΌ, Π½ΠΎ Π½ΠΈΠΊΠΎΠ³Π΄Π° Π½Π΅ ΡΠ°Π±ΠΎΡΠ°Π» Ρ ΠΌΠ°ΠΊΡΠΎΡΠ°ΠΌΠΈ. Π‘ΠΏΠ°ΡΠΈΠ±ΠΎ