Pregunta

I need to put the content of a django variable into an input type text value. The problem is that the django variable has two words and the input only shows the first one.

For example:

<input id="city" name="city" type="text" value={{ form.city.value }}>
{{ form.city.value }}

If form.city.value contains "New York", the input shows "New" and the second line shows "New York".

Any ideas to solve this?

Thanks.

¿Fue útil?

Solución

That should work, I think you missed the quotes to wrap {{ form.city.value }}. Declare your input like this:

<input id="city" name="city" type="text" value="{{ form.city.value }}">

Hope it helps!

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top