Skip to Content Skip to Menu

Dependent Drop Down

8 years 4 months ago #281429 by tjohns92109
Dependent Drop Down was created by tjohns92109
I'm trying to figure out how to have one drop down that would basically be a category... then another dropdown that would be a sub-category. Let's say I have 'trees' for a main category. Then I want the sub-category to only show dependent sub-categories like 'elm' and 'pine', but not 'bmw' because that would go with 'cars' as the top level category. Kind of a long explanation for something that you see all the time haha.

Anyway, I've tried all kinds of things. I created a stand-alone category creator form where you select the parent category and it inserts that parent category into a new column I created in the database for the sub-category, 'parent'. I'll attach a snapshot of the table in case that was confusing.

I then created a Query Drop Down type field for this subcategory and used the following statement...
SELECT fieldvalueid,fieldid,fieldtitle,fieldlabel,parent FROM jos_comprofiler_field_values WHERE parent = '[cb:userdata field="cb_cats" /]';

No luck there. For one, the 'cb_cats' field would have to be saved (and I could possibly make the 'cb_cats' field only available and required at registration, which might solve this). But, not only is the query not working (it's selecting all categories instead of just ones with the parent they had selected), but it's also showing them duplicated, which I believe might be a bug in the query drop down. I'll paste the html that was output at the bottom of this post.

Conditionals would work for this, but there is only 5 conditional tabs available, which isn't enough.

Is there any way to accomplish this? I should mention I have the query plugin version 4.0.5 so there is no 'update on' parameter. I don't even know if that would help. And if it would, I don't think there's a way to 'buy a new version' of it.

<select name="cb_subcats" id="cb_subcats" class="form-control" aria-invalid="false">
<option value=""></option>
<option value="Catering Company" id="cbf258">Catering Company</option>
<option value="Wedding Assistant" id="cbf259">Wedding Assistant</option>
<option value="Catering Company" id="cb_subcats__cbf2">Catering Company</option>
</select>
Attachments:

Please Log in or Create an account to join the conversation.

  • villy
  • villy
  • OFFLINE
  • Posts: 35
  • Thanks: 7
  • Karma: 1
8 years 3 months ago #281935 by villy
Replied by villy on topic Dependent Drop Down
Hi
I would like to help but I am not sure I understood what you want to accomplish.
Should that be a menu and every dropdown selection a user list?

Please Log in or Create an account to join the conversation.

8 years 3 months ago #281953 by tjohns92109
Replied by tjohns92109 on topic Dependent Drop Down
Thanks, but I've found that what I needed to do won't work without the newer version of the query plugin. The version I have doesn't have a 'fire on' (or something like that) field. There's no way to make the second dropdown populate depending on the first dropdown selection without the new plugin. So we've just ditched the whole idea in order to proceed. But thanks again!

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum