thedevdojo / voyager

Voyager - The Missing Laravel Admin
https://voyager.devdojo.com
MIT License
11.72k stars 2.67k forks source link

Formfield display option id for select : id is set to field's name #5784

Open toto975 opened 10 months ago

toto975 commented 10 months ago

Laravel version

9.31

PHP version

8.24

Voyager version

1.5

Database

MariaDB 10.3

Description

The custom id set in the bread for a select field is in the name of the displayed field. The for property of the label is not good also.

Steps to reproduce

In the bread, set the custom id

    "display": {
        "id": "theme_id"
    },

Open the form the custom id is set to the name, no id is set.

<select class="form-control select2-ajax select2-hidden-accessible"
=====>  name="theme_id" <=====
data-get-items-route="http://my_route" data-get-items-field="news_hasone_theme
_relationship" data-id="7246" data-method="edit" required="" data-select2-id="1" tabindex="-1" aria-hidden="true">...</select>

Expected behavior

The id must be set, not the name. something like :

<select class="form-control select2-ajax select2-hidden-accessible"
=====>  id="theme_id" <=====
data-get-items-route="http://my_route" data-get-items-field="news_hasone_theme
_relationship" data-id="7246" data-method="edit" required="" data-select2-id="1" tabindex="-1" aria-hidden="true">...</select>

Screenshots

image

Additional context

No response