Make form input auto-focus declarative.

This commit is contained in:
Daniel Blankenberg
2013-05-08 10:58:52 -04:00
parent fb0cd7b304
commit 12b858f9cd
3 changed files with 13 additions and 6 deletions
-5
View File
@@ -705,9 +705,4 @@ $(document).ready( function() {
return anchor;
});
// Auto Focus on first item on form
if ( $("*:focus").html() == null ) {
$(":input:not([type=hidden]):visible:enabled:first").focus();
}
});
File diff suppressed because one or more lines are too long
+12
View File
@@ -73,6 +73,18 @@
image_path: '${h.url_for( "/static/images" )}'
});
</script>
%if not form_input_auto_focus is UNDEFINED and form_input_auto_focus:
<script type="text/javascript">
$(document).ready( function() {
// Auto Focus on first item on form
if ( $("*:focus").html() == null ) {
$(":input:not([type=hidden]):visible:enabled:first").focus();
}
});
</script>
%endif
</%def>
## Additional metas can be defined by templates inheriting from this one.