summaryrefslogtreecommitdiff
path: root/ishtar_common/wizards.py
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/wizards.py')
-rw-r--r--ishtar_common/wizards.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py
index 2cf7a1b9c..475c426bb 100644
--- a/ishtar_common/wizards.py
+++ b/ishtar_common/wizards.py
@@ -1224,10 +1224,17 @@ class Wizard(IshtarWizard):
frm = form.forms[0]
if frm:
# autofocus on first field
- first_field = frm.fields[list(frm.fields.keys())[0]]
- attrs = first_field.widget.attrs
- attrs.update({"autofocus": "autofocus"})
- first_field.widget.attrs = attrs
+ first_field = None
+ for key in frm.fields:
+ field = frm.fields[key]
+ if not field.widget.input_type == "hidden":
+ first_field = field
+ break
+ if first_field:
+ attrs = first_field.widget.attrs
+ attrs.update({"autofocus": True})
+ first_field.widget.attrs = attrs
+
if not step:
step = self.steps.current
if self.filter_owns_items and self.filter_owns and step in self.filter_owns: