Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Populate Select Form Element by a RAW SQL query

Hello guys!

I'm wondering about the structure of the "object" or "array" to pass to a view variable for being used in a Select form element.

My actual variable looks like.

array (size=4)
  0 => 
    array (size=2)
      'id' => string '60' (length=2)
      'name' => string 'ClientOne' (length=9)
  1 => 
    array (size=2)
      'id' => string '61' (length=2)
      'name' => string 'ClientTwo' (length=9)
  2 => 
    array (size=2)
      'id' => string '62' (length=2)
      'name' => string 'ClientThree' (length=11)
  3 => 
    array (size=2)
      'id' => string '63' (length=2)
      'name' => string 'ClientFour' (length=10)

In my volt tempalte I have something like this:

        {{ select('client', clients, 'using': ['id', 'name'], 'id' : 'client', 'required' : 'required',  'class' : 'form-control') }}

What is wrong?

edited Jan '18

Found it!

Are associative arrays like array( 'id_val' => 'name_val');