Display field type getting focus
Display field type getting focus
For the Display field type (plugin) is there a way to skip over it when the form considers the focus? I've noticed that when the first field is a Display type there appears to be no initial focus on the form.
I'm assuming because the default focus is 0, which ends up being an HTML element.
I understand I can set the focus to a different field, but I was wondering if Editor couldn't see that the field shouldn't get the focus.
I haven't checked, but disabled or hidden fields might have the same concern.
This question has an accepted answers - jump to answer
Answers
Good point. Currently no, there is no way to skip over a field for focus like that. Editor will attempt to set focus on the field that was specified (0 by default as you say). If it can't, no focus will be set. Currently you'd need to set focus on index 1.
Allan
For anyone interested, here's the solution I ended up doing.
I wanted the form to open and skip field types that cannot accept an entry (
display
,hidden
, andreadonly
) and also skip fields with a default value.In the editor's
open
event I look for the first field where thecanReturnSubmit
function is notundefined
(ornull
) and the default value isnull
to find the first field open for immediate entry.This does NOT address the
readonly
field, which does have acanReturnSubmit
function unless it has a default value.Seems hackish, especially checking the
canReturnSubmit
, but it works for what I'm doing.@allan, maybe a
canReceiveFocus
field property would be helpful?At any rate:
I like that. Added to my list