Forums

Chronoform Drop down Auto Populate functions when typing adm

shahabpk 12 Jul, 2019
Hi
I created a form with a drop down field configured to auto populate users from joomla user table looking in to the demo provided. Its working fine except that when we start to type adm it shows functions and scripts in populated suggestions. how can we solve this problem. Please see the attached screen shot of the problem.

Is it possible to display only a particular user groups in the drop down by joining two tables (# _users and #_user_usergroup_map etc) if possible how can it be done?
Thank you
Max_admin 13 Jul, 2019
I'm not sure where does this code come from, how did you configure the "Read data" action in your form auto complete event ?

And yes, you can select users from a specific group with the correct "Read data" settings, use a JOIN and supply the correct where conditions.

Best regards
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
healyhatman 13 Jul, 2019
Make sure your auto complete event is set to "standalone" and that Auto Display View is switched off
shahabpk 14 Jul, 2019
The read_data settings are simple one as given in demo except that the table used was #_users to populate the dropdown. i just typed admin to check whether it is populating or not. I put auto complete event to "auto" as in the demo and custom-code json in auto event as in the demo. I couldn't find Auto Display View is switched off though. I am using 6.1 view and what i found is when you enable server validation or follow page order in main screen , it is not working properly.

I am struggling to configure the read data function properly to join #_users and #_User_group_map table to read data from a particular group. Could you guide me on correct way to join two models? Thank you
healyhatman 15 Jul, 2019
your autocomplete events need to be set to standalone a d should have auto display view turned off
healyhatman 15 Jul, 2019
Join them by adding a second model on the read data action. Select the table you want joined, enter in the foreign key and choose the correct join condition. Probably "first matching record, foreign key in this table"
shahabpk 16 Jul, 2019
Can you guide me to some forum posts which gives some examples on how to put conditions correctly while joining two models. here is my requirement.
I need to populate a drop down with users of a particular group ( with group_id = 11)
The SQL query which i want to replicate in chronoform is [pre]SELECT model1.name, model1.username FROM
htq0k_users as model1[br] JOIN htq0k_user_usergroup_map as model2 onmodel1.id=model2.user_id[br] WHERE model2.group_id=11[/pre]
[br]​
First I created a DB Read action with model named Data1 and selected table #_users with following settings.


This part works fine and names are populated in dropdown when {var:read_data3 } is added in options field.
But I am not successful with the next step. Adding additional model as shown below. I have no clear idea how to put condition for joining tables to refelect the above sql query.



Dear healyhatman , Can you give some light please?
    healyhatman 16 Jul, 2019
    Answer
    In foreign key just put user_id
    In the where conditions on the first tab add your Data2.group_id = 11
    shahabpk 17 Jul, 2019
    1 Likes
    Worked Perfectly!
    Thank you very much. I learned new things today.
    This topic is locked and no more replies can be posted.