Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Avoid duplication of form input element ID in Django

Tags:

html

forms

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.

like image 439
Evgeny Avatar asked Aug 10 '09 01:08

Evgeny


1 Answers

You need to use form prefixes, as documented here.

like image 108
shanyu Avatar answered Sep 23 '22 03:09

shanyu