Ticket #7985: 7985.patch

File 7985.patch, 1.2 KB (added by Fraser Nevett, 16 years ago)

Patch to use addEvent

  • django/contrib/admin/templates/admin/change_form.html

     
    6262{% if add %}
    6363<script type="text/javascript">
    6464{% for field in adminform.prepopulated_fields %}
    65     document.getElementById("{{ field.field.auto_id }}").onchange = function() { this._changed = true; };
     65    addEvent(document.getElementById("{{ field.field.auto_id }}"), 'change', function() { this._changed = true; });
    6666    {% for dependency in field.dependencies %}
    67     document.getElementById("{{ dependency.auto_id }}").onkeyup = function() {
     67    addEvent(document.getElementById("{{ dependency.auto_id }}"), 'keyup', function() {
    6868        var e = document.getElementById("{{ field.field.auto_id }}");
    6969        if (!e._changed) { e.value = URLify({% for innerdep in field.dependencies %}document.getElementById("{{ innerdep.auto_id }}").value{% if not forloop.last %} + ' ' + {% endif %}{% endfor %}, {{ field.field.field.max_length }}); }
    70     }
     70    });
    7171    {% endfor %}
    7272{% endfor %}
    7373</script>
Back to Top