A
A
anikitin352014-11-19 09:46:24
Drupal
anikitin35, 2014-11-19 09:46:24

How can I correctly connect the script to the views exposed filters form in drupal?

Everyone knows what a standard multiselect looks like in views exposed form. This is a list with the ability to select one or more values.
Everything seems to be simple. I connected another script to the form, turned it into a dropdown multiselect with wide possibilities. In the theme, drupal added js and css using the add_js and add_css methods with paths. Everything works as it should.
The problem is that every time the page is reloaded, the standard multiselect is displayed first, and only then (depending on the speed of the Internet) the view changes to what I intended.
I read many forums, tried to find answers. But I can't figure out how to get rid of this annoying standard multiselect!
View of my js document:

jQuery(document).ready(function($) {
....
});

Help me please! The goal is to force drupal to immediately use the script I need when loading the form.
For example bootsrap-multiselect.js and bootstrap-multiselect.css
THANK YOU!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Darkhan Kutzhanov, 2014-12-25
@dark_kz

Write a module that intercepts form generation.

<?php
/**
 * Implements hook_form_alter().
 */
function mymodule_form_views_exposed_form_alter(&$form, $form_state, $form_id) {
  drupal_set_message("Form ID is : " . $form_id);
}
?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question