I’ve been working through the Django Book and ran into trouble understanding forms.
Reference: http://www.djangobook.com/en/2.0/chapter07.html
The following confuses me:
<html> <head>
<title>Search</title> </head> <body>
<form action="/search/" method="get">
<input type="text" name="q">
<input type="submit" value="Search">
</form> </body> </html>
I understand that ‘action’ dictates which URL to go to and ‘name’ determines how to distinguish the HTTP response that comes in but what does ‘value’ do? When would I need to access ‘value’ or how?
The value=”Search” part is HTML. It sets the display text on the submit button. It’s purely HTML, nothing to do with Django.
You’d be able to set the value via your Django code if you really wanted to, but I’d imagine that’s about the limit of modification you’d want.