I am trying to add a "switch" that sets the value of a filter to update the results.
In my view, I have the following filter:
'''
[wpv-control-postmeta field="nkd-ticket-status" type="select" default_label="-- availability --" format="%%NAME%% (%%COUNT%%)" url_param="ticketstatus"]
'''
I have added the following javascript:
'''
<script type="text/javascript">
// dropdown
// soldoutswitch
//
function soldoutswitchTrigger(checked)
{
var ticketstatusDropDown = document.getElementById("wpv_control_select_nkd-ticket-status");
if (checked)
{
ticketstatusDropDown.selectedIndex = 0;
} else {
ticketstatusDropDown.value = "Available";
}
ticketstatusDropDown.onchange();
//wpv-filter-48137
jQuery('form[name="wpv-filter-48137"]').first().trigger("change");
//alert("triggered" + checked);
}
</script>
'''
I want to be able to change this with javascript and then trigger an ajax reload. However, when I push the change with the javascript below the dropdown changes, the search results do not reload.
*How do I trigger the search results to reload based on a change to the form?*
Hello. Thank you for contacting the Toolset support.
There should be change event for the dropdown you will actually have to fire but let me first review your current setup.
Can you please share problem URL and steps that I need to follow and tell me on what action you want to fire the change event and also share admin access details.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
I can offer you the sandbox site where you can implement the test demo and tell me what you want to filter and trigger and on what action.
Here is the sandbox site and you can auto-login to it using the following link:
- hidden link
Either you can create a test demo with the above sandbox site or send me admin access details to your site with problem URL and tell me on what action you what to fire what event.
I need that because I'll not be sure above HTML elements added to your page or how your custom code works.
I have set the next reply to private which means only you and I have access to it.
I just understand that you want to call a "change" event using the custom Javascript but what I want is for what kind of field and on what course of action.
I can see you have select dorpdown box added a filter. Do you want to trigger change event for that select dropdown filter? If yes, but on what action you want to automatically trigger the dropdown change event?
If you can share all those information or exact steps on what steps you want to call the select dropdown change event then I will create a demo for you and share with you. If you agree I can add a button and on button click I will call the select dropdown change event - is that ok for you or you want something else?