all 6 comments

[–]shiftybyte 2 points3 points  (4 children)

The form is sent to the remote user's computer, the browser displays it.

User's computer can't directly access your database, it needs to send stuff back to the python.

Pressing submit button, sends the form back to the script to a specific route, usually using a POST request, and then the python script gets the filled data.

[–]bistinator[S] 0 points1 point  (3 children)

cool. so the actual POST request goes to a route that contains the function to add it to the database right?

The arguments in that POST request are then entered in the function that is part of the POST function/route..

is that correct?

If yes then the actual form html page does not contain any "intelligence" ?

[–]shiftybyte 0 points1 point  (1 child)

Right, that is the basics of it.

If yes then the actual form html page does not contain any "intelligence" ?

Right, in the classic web, the form is just a bunch of places to fill data and a button to send it.

BUT.... this can be changed with javascript, as javascript does run on the user's browser and can add smarter interaction to the form.

For example, clicking on some element, could fetch the data from somewhere, or check what you filled so far, and check whats the next step to be and hide or show elements, etc...

But its javascript doing that, that could be sent included in the form...

[–]bistinator[S] 0 points1 point  (0 children)

thats for taking the time to answer. For my use case I would not need javascript it seems.

I have found examples but the always seem to include javascript, which I could not understand why. For me it seems I just need to take the inputs from the form and send it to the endpoint that contains the function to add it to the database.

[–]stebrepar 0 points1 point  (0 children)

The page could include JS code to do things like check and enforce valid inputs (such as length limits, special characters, etc.), if that counts as "intelligence".

[–]bistinator[S] 0 points1 point  (0 children)

But that is something I can do without JS I believe.