1

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.

1 Answer 1

5

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!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.