Ticket #10573: 10573_r12827_with_fields.diff

File 10573_r12827_with_fields.diff, 784 bytes (added by Colin Copeland, 15 years ago)

alternative patch if #12627 is closed

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

     
    5555
    5656{% submit_row %}
    5757
    58 {% if adminform and add %}
    59    <script type="text/javascript">document.getElementById("{{ adminform.first_field.auto_id }}").focus();</script>
     58{% if adminform and add and adminform.form.fields %}
     59    <script type="text/javascript">
     60    (function($) {
     61        $(document).ready(function($) {
     62            $("input:visible:enabled:first").focus();
     63        });
     64    })(jQuery.noConflict());
     65    </script>
    6066{% endif %}
    6167
    6268{# JavaScript for prepopulated fields #}
Back to Top