Skip to content

Duplicate ID in rendered widgets #103

@dtougas

Description

@dtougas

Django form widgets automatically render an ID attribute on an INPUT tag. Your widget adds a duplicate ID attribute to the outer wrapping DIV. Since IDs should be unique, this violates the HTML spec, and can cause errors when attempting to use javascript/jquery to access the form fields via ID.

Here is an example of the output. Note that the IDs on both the DIV and the INPUT are the same.

<div id="id_date" class="input-group date">
       <input class="form-control" id="id_date" name="date" type="text">
       <span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
       <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
</div>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions