Pregunta

I am able to fill input fields with values (strings) using the $fields[] array in a function I call using [!eForm? ... &eFormOnBeforeFormParse ... !]. I tried to submit a string value to the select box, but this does not work. I guess that the select box is an array instead of strings. I did not find a documentation about the structure of this array or how I can control it.

So my question is: How can I preselect the select box based on the data I find in my database?

I appreciate any help. (Your answer does not need to contain database calls, though.)

¿Fue útil?

Solución

Just figured it out myself:

Select boxes allow multiple selections. I forgot about this, because you do not see this very often. Therefore, the value has to be an array to allow multiple selections. So when you have one pre-selection, wrap it in an array. For instance:

$fields['state']=array('CA');

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top