Multi select Problem - Dropdown with multiple values from other table

Multi select Problem - Dropdown with multiple values from other table

schwaluckschwaluck Posts: 103Questions: 27Answers: 1
edited March 2021 in Free community support

Hello all,

I have the following problem:
In my table I have a dropdown field where several values can be selected. The values for this field are dynamically loaded from another table.

The loading of the values works like a charm. Now, however, an error occurs when I want to create / edit an entry that should have more than one value for this field.

Example: For the field "test" I select the values "1", "2" and "3" and in the dropdown the values "1", "2", "3", "4", "5" are available for selection. Then, although I have only selected "1", "2" and "3", "1", "2", "3", "4", "5" is automatically set as the value for this field.
However, if I select only one of the five values, e.g. "2", then only "2" is set.

My current code:

Server side:

            Field::inst( 'test' )
                ->options( Options::inst()
                    ->table( 'test' )
                    ->value( 'name' )
                    ->label( 'name' )
                    ->order('name asc')                     
                )
                ->validator( Validate::notEmpty( ValidateOptions::inst()
                    ->message( 'test' ) 
                ) ),

JS:

            {
                "label": "test:<sup>*</sup>",
                "name": "test",
                "separator": ", ",              
                "type": "select",
                "multiple": true,           
            },  

Does anyone have an idea what could be the reason for this?

Many greetings
Schwaluck

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Hi Schwaluck,

    Are you able to give me a link to a page showing the issue so I can take a look at it please? I'm not immediately sure what is going wrong here - I'm wondering if there is something to do with the typing (e.g. string v numbers) or perhaps the database type is something other than a string for this field?

    Allan

  • schwaluckschwaluck Posts: 103Questions: 27Answers: 1

    Hi Allan, the site is completely restricted, but I have created a test account for you to log in to the site. I have sent you the account details via direct message.

    Thanks for your help and best regards
    Schwaluck

This discussion has been closed.