A
A
asdevlog2019-01-19 22:38:27
Python
asdevlog, 2019-01-19 22:38:27

How to organize calculation on the form when using Flask?

Good afternoon.
There is a form for editing/creating a record, let's say

class FormList(FlaskForm):
    od_departure = IntegerField('Поле1', default=0)
    od = IntegerField('Поле2', default=0)
    od_return = IntegerField('ПолеИтог', default=0)

How to calculate the od_return field on the form when changing the od_departure or od field?
Can Flask be used for this? Or is it necessary to do it in JS?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vadim Shatalov, 2019-01-19
@netpastor

You have options:
1. Calculate everything directly on the client in jiese
2. Send the form data to the server with yajax, calculate and return the result there, set it yourself
3. Post the form to the server, calculate and re-render with the calculated data

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question