10 years ago
Topic
Hi all!

I'm using a select dynamic field on a form (using free query), showing a specific group of users (the name is showed). The problem: when I fill the form this field isn't saved to database. I tried "Add static options", and if I choose one of them the string is saved to database with success, but if I choose one of content dynamically loaded from database the string is not saved (or not showed when list project).

I've seen some issues with this, but I think that none exactly of this kind. I apologize if this question is replicated.

I think the problem can be related with "Options Name" and "Options Value" that in this case isn't defined.

My free query is:
SELECT u.nameFROM #__users uINNER JOIN (SELECT * FROM #__user_usergroup_map WHERE group_id=2) g on u.id=g.user_id;


Thanks
Get a Book for SEBLOD
4229 Posts
Kadministrator
10 years ago
5
Level 1
Hi,

you need to output text and value from your query, e.g. SELECT u.name AS text, u.id AS value ...
10 years ago
4
Level 2
Hi Klas,

I tried what you said to do but also doesn't worked!
I know the field is correct, because as said earlier I tried to use "Add static options", and if I choose one of them the string is saved to database with success and showed.


Thanks
4229 Posts
Kadministrator
10 years ago
3
Level 3
There are no known issues with select dynamic, so it must be something with your setup. Which storage do you use? Also please post the whole query
10 years ago
0
Level 4
I resolved my problem now! =)

Change your suggestion and use u.name AS value instead u.id AS value, that in database I want store names and no id's (I have Varchar(255)).


Thanks a lot!
27 Posts
jsfernando
10 years ago
1
Level 4

Klas,

Sorry, be back on the same subject, but I think I've posted something and not heard back ... 

So the problem is the same with u.name AS text and u.id AS value ... 

I have a query for users of a particular group ... 

SELECT #__users.name AS text, #__users.id AS value 

FROM #__users INNER JOIN #__user_usergroup_map ON #__users.id = #__user_usergroup_map.user_id 

WHERE #__user_usergroup_map.group_id = 24 

Order By #__users.name

All names appear in the select, but when I save, not save the ID field of the table!

Where is the problem? 

I saw your comment, saying the field in the table?! 

Free table in my field is varchar (100) which should record the value AS # __users.id

Tks,

10 years ago
0
Level 5

Hi jsfernando,

You just need to change varchar (100) to int in your database, if you want to save the user ID.

Hope this helps

Get a Book for SEBLOD