5

I have this code in a Django Template:

input  type="text" name="ppoisNomePOI"  value={{ request.session.ppoisNomePOI }}

If my "request.session.ppoisNomePOI" is "John" then in the page it appears "John" in the input, but if my "request.session.ppoisNomePOI" is "John Flanders Simpson" it only appears "John"

I assume it was a problem with the spaces in the value.

Rizier123
  • 58,877
  • 16
  • 101
  • 156
Krull
  • 259
  • 2
  • 6

1 Answers1

6

From the sounds of it, the browser is probably treating the subsequent words as empty attributes and being interpreted as:

<input type="text" name="ppoisNomePOI" value="John" Flanders Simpson>

Try putting quotes around the value.

value="{{ request.session.ppoisNomePOI }}"

This will force it to be interpreted as:

<input type="text" name="ppoisNomePOI" value="John Flanders Simpson">
TheZ
  • 3,663
  • 19
  • 34