Skip Navigation

[Resolved] I need to create custom select

This support ticket is created 6 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 5 replies, has 2 voices.

Last updated by Shane 6 years, 2 months ago.

Assisted by: Shane.

Author
Posts
#1186679

Hello,

I have problem using custom select(not really a select but a hidden select that is triggered by javascript when click event happens on divs that are styled as i want).

I need to create custom select in search of view. There is no possibility to style option tags(i don't meen in toolset but in general).
So is there a way how to use toolset to create this(use different tags than select and option to create element that will behave as select)?
If not I have already written all needed javascript to hide select and replace it with div's that look like my wanted styled select. When I click on div that represent option I trigger selecting by javascript(...select.selectedIndex = index;...). And there is my problem. I use AJAX for getting new results, but it's not triggered. Could you please tell me why?
I have already tried to to do other javascript approaches, non of them is working(option.selected="selected", select.value="selectedValue"...).
So I would really need to know how to trigger it or if there is a function that I can call directly from my onClick callback.

I cannot send link to my page, I have it on lacalhost for now.

Thanks for your answer in advance.

Ferdinand

#1186716

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Ferdinand,

Since you are using AJAX you will need to put your javascript into the callback functions as well.

On your view in the JS editor for the filter section. There should be a button for "Frontend Events" from here you can add the appropriate callback function then add your js code into this.

Please let me know if this helps.
Thanks,
Shane

#1186725

Hey,

no this is actually not helping :-/
I have hidden select, so I cannot click on it and so callbacks are not triggered. What I need is trigger ajax call. I thought it would work by setting selectedIndex but it's not. Is there a way to do it?

#1186777

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Ferdinand,

Do you mean trigger the ajax call on views using that hidden filter?

#1186862

Yes 🙂

#1186935

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Ferdinand,

Perhaps you need to simulate the click by using the .click() function in jquery.