0

I have a view with exposed filter "Has taxonomy term" (filter identifier: "topic") and exposed sort: Created (default one) and Rating. On a view page, when I change sort option to Rating, url of a view page is becoming ?topic=&sort_by=rating

How to remove this empty argument from page url?

I tried

  $('#views-exposed-form-taxonomy-term-page').find(':input[value=""]').attr('disabled', true);

and

  $('#views-exposed-form-taxonomy-term-page').submit(function() {
    $(':input', this).each(function() {
        this.disabled = !($(this).val());
    });
  });

but it didn't work.

1 Answer 1

0

solved the problem:

(function ($) {
  Drupal.behaviors.citatyTaxonomy = {
    attach: function(context) {

      // disable blank input fields
      function disableEmptyInput() {
        $('#views-exposed-form-taxonomy-term-page').find(':input[value=""]').attr('disabled', true);
      }

      // on form submit
      $('#views-exposed-form-taxonomy-term-page').find('.views-submit-button input[type=submit]').click(function(){
        disableEmptyInput();
      });

      // view with auto-submit
      $('#views-exposed-form-taxonomy-term-page').find('.ctools-auto-submit-click').click(function(){
        disableEmptyInput();
      });

    }
  };
})(jQuery);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.