By wes1 on Saturday, 12 September 2015
Posted in Technical Issues
Replies 10
Likes 0
Views 795
Votes 0
Hello support,

Could you please advice the best way for adding a dropdown selection list with approx. 900 options on the registration form of EasySocial? Instead of adding these 1 by 1 manually I would like to import them directly into the database by using phpmyadmin. Could you provide me with a query to run, so I can import a csv file containing the 900 options?
The csv datafile will be like this

option1,;placeoption1
option2;placeoption2
option3;placeoption3
...and so on...

Thanks and regards
Hey wes1,

I am really sorry for the delay of this reply as it is a weekend for us here. Unfortunately right now there is no quick way to do this By the way, adding 1900 over options for a dropdown is pretty overkill don't you think so?
·
Sunday, 13 September 2015 13:31
·
0 Likes
·
0 Votes
·
0 Comments
·
I am asking this because there are approx 1900 clubs in the country, and I would like to have users, when they register, select which club they are a member of.

The selection list would be containing:

name club 1 , city of club 1
name club 2, city of club 2
name club 3, city of club 3
and so on

Ideally the list can be sorted on city and on clubname.

How best to do this?
·
Monday, 14 September 2015 01:08
·
0 Likes
·
0 Votes
·
0 Comments
·
Shouldn't you use this on the new auto complete field of ES 1.4? This way the user can type and get the results as they type the club name.
·
Monday, 14 September 2015 12:33
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Wes1,

To manually insert the dropdown options into db tables using insert statement, you first need to know your field's id for your dropdown field. Below sql will retrieve all the fields for your profile type.


select * from jos_social_fields where step_id in (select id from jos_social_fields_steps where uid = xx and `type` = 'profiles');


Replace jos_ to your down database table prefix and xx is your profile type id. To get your profile type id, when you are editing a profile type, from the url you should be able to see something similar like below:

administrator/index.php?option=com_easysocial&view=profiles&id=22&layout=form&activeTab=fields


In the above, the profile type id is 22.

If you look at the attached image, say I want to add the options for field id of 1628, now i need to run the insert statement to manually add the options for this dropdown field.


insert into jos_social_fields_options (`parent_id`, `key`, `ordering`, `title`, `value` ) values
(1628, 'items', 1, 'youroptionlabel1', 'value1'),
(1628, 'items', 2, 'youroptionlabel2', 'value2'),
(1628, 'items', 3, 'youroptionlabel3', 'value3');


Hope this help
Sam
·
Monday, 14 September 2015 17:01
·
0 Likes
·
0 Votes
·
0 Comments
·
Thank you for the advice!
Before starting, what is the best field to use for this?
is it multilist, or dropdown list, or autocomplete?
·
Monday, 14 September 2015 18:23
·
0 Likes
·
0 Votes
·
0 Comments
·
It depends on what you want to achieve actually but I would opt for a dropdown list if you are only going to allow them to choose a single value.
·
Monday, 14 September 2015 22:30
·
0 Likes
·
0 Votes
·
0 Comments
·
Not sure if you have data for the "ordering field", if you don't you could easily populate all 1900 options by using a replacer tool (I use notepad++) to fill in a unique value between the key and title fields. After doing this there would literally be 1900 "unique-values" which would then be replaced by a number incremental. There are more examples out there for replace search incrementals: https://www.google.com/?gws_rd=ssl#q=replace+all+with+increment+number

Would be interested to hear how this goes.
·
Tuesday, 15 September 2015 01:21
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for sharing this Josh
·
Tuesday, 15 September 2015 01:22
·
0 Likes
·
0 Votes
·
0 Comments
·
In the admin the dropdown only has 2 fields: Title and Value
So I can use Value for 1 to 900 like Josh suggests,
and use Title for showing the clubname together with the cityname;
so the Title field of the dropdown shows in example: "Soccer Club Wolves - Wolverhampton"

Ideally I would have a second Title field i.e. Title 2 which could be used for the cityname,
so the clubname and cityname get seperate datafields,
because the clubname and city name are seperate entities.
Is that somehow possible to add to the dropdown, a 2nd Title field?

If not, I will have to combine the cityname and clubname. Thank you for advicing, that is really great.
·
Tuesday, 15 September 2015 02:37
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Wes1,

Is that somehow possible to add to the dropdown, a 2nd Title field?


I am sorry but this is not possible at the moment
Sam
·
Tuesday, 15 September 2015 10:35
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post