F
F
Ftffggf2022-03-20 00:56:47
Django
Ftffggf, 2022-03-20 00:56:47

How to immediately enter the answer to a record in django python in a form?

I am creating a webquest in django. It is necessary for me that at in input of the text in the form the answer was immediately deduced. For example, you need the user to write a certain word in the form. If the user entered the correct word, then the answer "You entered everything correctly" will immediately be displayed, if he entered the wrong word, then the message "You entered the wrong word" will appear. How to implement this feature?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Leonid, 2022-03-20
@bravebug

By the description, you want the data on the page to change interactively when the data in the input field changes, without having to send the data to the server.
It's not really related to Django directly. Javascript is responsible for the interactive component of any web page.
In response to the event of changing the content of the input field, a JS function must be executed that will compare the entered value with the required one, passed to the page in advance and hidden, or sending the input to the server, where the value will be compared and the result of the comparison will be returned (true or false).
Learning the basics of JS and writing a similar function with knowledge of the basics of any programming language should not be difficult.
In extreme cases, you can google a ready-made solution.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question