Evgeny
Evgeny

Reputation: 10896

Avoid duplication of form input element ID in Django

When two forms on one page have the same-named field, Django will generate invalid HTML:

<!--one form -->
<input id="id_name"..../>
...
<!--another form-->
<input id="id_name".../>

Invalid because two or more nodes share the same id.

How can this be avoided?

Thanks.

Upvotes: 8

Views: 2786

Answers (1)

shanyu
shanyu

Reputation: 9716

You need to use form prefixes, as documented here.

Upvotes: 15

Related Questions