This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

KurtJensen
KurtJensen

Is there an easy way to set focus on backend popup (one to many relation) Form?

When I an entering items into a backend pop-up form I have to hit tab 2x to get to the first field. Would be nice if focus set on first field on pop-up.

I tried adding tabindex :

# ===================================
#  Form Field Definitions /models/units/fields.yaml
# ===================================

fields:
    #id:
    #    label: ID
    #    disabled: true
    name:
        label: Name
        attributes: 
            tabindex: 0
        comment: The unit label LETTER / NUMBER.
        placeholder: 101
        type: text

in fields.yaml but it did not help.

Relation file ( __config_relation.yaml__ ) looks like:

# ===================================
#  Relation Behavior Config  for \Apartments\Controllers\Building
# ===================================

units:
    label: Units
    list: ~/plugins/kurtjensen/apartments/models/units/columns.yaml
    form: ~/plugins/kurtjensen/apartments/models/units/fields.yaml
    manage:
        recordsPerPage: 20
    view:
        toolbarButtons:
            create: create
            delete: delete

Last updated

axomat
axomat

Try

# ===================================
#  Form Field Definitions /models/units/fields.yaml
# ===================================

fields:
    #id:
    #    label: ID
    #    disabled: true
    name:
        label: Name
        attributes: 
            autofocus: autofocus
        comment: The unit label LETTER / NUMBER.
        placeholder: 101
        type: text
KurtJensen
KurtJensen

Thanks axomat but that did not seem to change anything for me. Still have to hit "TAB" two times to get into first field on popup form.

jan-vince
jan-vince

Quite late :), but this works for me:

attributes:
   autofocus: ''

1-4 of 4

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.