8 years ago
4
Topic

HI, I'm trying to add a static option to my dynamic select box but it just shows the SQL in the list, not the results of the query..

Query in static option:

SELECT title AS text,id AS value FROM #__categories WHERE id = '2'

The output in the select box is:

SELECT title AS text,id AS value FROM #__categories WHERE id

I should mention I am using chosen.js on this selectbox.  But I would have thought the text and value would already have been populated by the time the select box is rendered no?

Get a Book for SEBLOD
4229 Posts
Kadministrator
8 years ago
0
Level 1

Hi,

yes, that is as it should be, static option is just a fixed value like in select simple, you can't use a query there.

8 years ago
2
Level 1

Care to be a little more helpful?

The instructions here claim something different:

https://www.seblod.com/resources/extensions/archives/seblod-2-x-select-dynamic-field

Please see section on static options and using sql queries.

4229 Posts
Kadministrator
8 years ago
1
Level 2

Those lines are explanation of the free mode. There should be a divider line between "Add Static Options" and "Free (developer)" . 

Static options are added like option1=1  (text=value) or just as "something" where option text is the same as value.

8 years ago
0
Level 3

OK yes, that instruiction does not infer that at all.  Clear now though.

In another reply you mentioned about the optogroup, does that mean I can have multiple Free entries one on each row?

**Update OK on 1 SQL query total, so your suggestion is to add these values in a column which I guess would work but isn't ideal.  Could the fixed option not include a group label param?

Get a Book for SEBLOD