Hello,
I am aiming to replace Select and Select2 fields by the autocomplete field.
I amended the field type in the Javascript side from:
fields: [
{
"label": "Type d'article:",
"name": "fac_articles_natures.articletype",
type: 'select',
placeholder: '',
placeholderDisabled: false,
placeholderValue: null
}
]
To:
fields: [
{
label: 'Type d\'article:',
name: 'fac_articles_natures.articletype',
type: 'autocomplete'
}
]
it works in the sense that:
- the "labels" are listed in the fields
- when editing, the displayed "label" is correct
- when editing, I can pick another "label" and when saving, the correct "value" is stored in the database
BUT: when editing, when I click on the "label" I want, the "label" is automatically replaced by the "value" which is different due to the use of a leftjoin
->fields(
Field::inst( 'fac_articles_natures.articletype' )
->validator( Validate::notEmpty( ValidateOptions::inst()
->message( 'Requis' )))
->options( Options::inst()
->table( 'fac_articles_types' )
->value( 'articletype_id' )
->label( 'articletype' ) ),
Field::inst( 'fac_articles_types.articletype' )
)
->leftJoin( 'fac_articles_types', 'fac_articles_types.articletype_id', '=', 'fac_articles_natures.articletype' )
Does anyone know how I can trick the code to avoid that?