Spaces in string in <input type="text"> django templates

django, input, spaces, templates, text

Solution

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">

Problem

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.

Original source