Dynamic select list on user account / add user page
Permalink
I want to add a form select input on the user account page / add user page with a dynamic list of options / values.
I know how to get the dynamic list form a database table and create a dynamic list for the select options.
Question: Where and how to add this to the account/add user page and save this to the user table? (and the attribute tables)
I know how to get the dynamic list form a database table and create a dynamic list for the select options.
echo $form->select('clientsID', $indexed_array, '0');
Question: Where and how to add this to the account/add user page and save this to the user table? (and the attribute tables)
The frontend part I got (something similar as the select from language or timezone).
But saving is a problem (and using the concrete's own functions).
But saving is a problem (and using the concrete's own functions).
I think you can do that simply by creating a new user attribute. IF it is required on registration, it will appear on the add new user screen and you can choose a value from it that will be attached to the user being created
I don't want to fill in all the client names (via concrete interface). The complete list with names and id's are in a second database synced with the clients software.
The problem with this user attribute is:
- You can't edit the values that way, only the display names.
- If something changes in the external db you also have to edit the display name in concrete.
- Have to exactly match names (strings with special chars), its better to match id's.
If i could fill in key -> value it wouldn't be such a problem.
The problem with this user attribute is:
- You can't edit the values that way, only the display names.
- If something changes in the external db you also have to edit the display name in concrete.
- Have to exactly match names (strings with special chars), its better to match id's.
If i could fill in key -> value it wouldn't be such a problem.
oh sorry, I missed the "dynamic" aspect of your question.
Then maybe you should create a new attribute type which would get the data from the db as you want it.
You could probably do it quickly enough by modifying the core select attribute type
Then maybe you should create a new attribute type which would get the data from the db as you want it.
You could probably do it quickly enough by modifying the core select attribute type
I planned to use this (manual input) as a backup. It works but is not ideal. (it breaks when the client name changes in the external db)
Better to modify the get_ and update_ functions from the controller.
But still not found the right combination of code to do it.
Better to modify the get_ and update_ functions from the controller.
But still not found the right combination of code to do it.
But take this approach cautiously, I have personally never tried something like that, just a thought at how you could do it, but certainly not the most thorough way.