Skip to content

Commit

Permalink
Fixes change_form first field focus. Fixes #290 #295
Browse files Browse the repository at this point in the history
  • Loading branch information
darklow committed Nov 19, 2014
1 parent 437f5ce commit 4ec2408
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion suit/templates/admin/change_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,11 @@ <h4 class="italic-title">{% trans 'tools'|capfirst %}</h4>
{% include 'suit/includes/change_form_includes.html' with position='bottom' %}

{% if adminform and add %}
<script type="text/javascript">document.getElementById("{{ adminform.first_field.id_for_label }}").focus();</script>
<script type="text/javascript">
(function ($) {
$('form#{{ opts.module_name }}_form :input[type!=button][type!=submit]:visible:enabled:first').focus();
})(django.jQuery);
</script>
{% endif %}

{# JavaScript for prepopulated fields #}
Expand Down

0 comments on commit 4ec2408

Please sign in to comment.