The port of the ctools autosubmit feature of d7 doesn't work in d7.


$view = new view;
$view->name = 'test1';
$view->description = '';
$view->tag = '';
$view->base_table = 'node';
$view->human_name = '';
$view->core = 6;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Defaults */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->display->display_options['access']['type'] = 'none';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['exposed_form']['options']['autosubmit'] = 1;
$handler->display->display_options['exposed_form']['options']['autosubmit_hide'] = 0;
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'node';
$handler->display->display_options['row_options']['links'] = 1;
$handler->display->display_options['row_options']['comments'] = 0;
/* Filter: Node: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['exposed'] = TRUE;
$handler->display->display_options['filters']['type']['expose']['operator'] = 'type_op';
$handler->display->display_options['filters']['type']['expose']['label'] = 'Node: Type';
$handler->display->display_options['filters']['type']['expose']['identifier'] = 'type';
$handler->display->display_options['filters']['type']['expose']['reduce'] = 0;

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->display->display_options['path'] = 'exposed';
$translatables['test1'] = array(
  t('Defaults'),
  t('more'),
  t('Apply'),
  t('Reset'),
  t('Sort by'),
  t('Asc'),
  t('Desc'),
  t('Items per page'),
  t('- All -'),
  t('Offset'),
  t('Node: Type'),
  t('Page'),
);

This example does reproduce the issue if you have ctools installed.

Comments

dawehner’s picture

Status: Active » Needs review
StatusFileSize
new1.05 KB

Here is a patch which fixes the issue.

The general problem is that


           $(this).after('<span class="views-throbbing">&nbsp</span>');
           // We have to actually tell it what button got clicked if we want
           // anything to be sent:
-          form.clk = this;

this here links to an object which doesn't have the bind() method of submit() but only in the case of auto-submit

eugenmayer’s picture

StatusFileSize
new770 bytes

hehe :)

Just added documentation to the patch, so we could remember the decision

eugenmayer’s picture

StatusFileSize
new840 bytes

just better docs + forgot about return false, must have been drunken writing those lines..

/me notes, the summary is wrong ( The port of the ctools autosubmit feature of d7 doesn't work in d7.) ...
rather means "it does not work in D6"..just to not confuse people :)

eugenmayer’s picture

StatusFileSize
new1.51 KB

well, after testing it, i recognised we forgot about the use-ctools-ajax button, which double-binds the submit button. Added this to the patch

esmerel’s picture

trigger testbot?

esmerel’s picture

Version: 6.x-3.x-dev » 7.x-3.x-dev
eugenmayer’s picture

@esmerel, did it already got applied to 6.x? or do you test it in 7.x and fix it downstream?

dawehner’s picture

Currently the process of fixing things is to get it fixed first in 7.x-3.x and then in 6.x-3.x. The patch didn't got committed.

It might be though different here, because views uses in d7 the core ajax api instead of it's own custom stuff,
so the problem shouldn't exist, but i'm not sure.

I wouldn't see myself as being able to review this change, i know the patch fixes something, but that's all.

eugenmayer’s picture

@ Daniel: Iam not very sure, that bug does not exist in D7, depends on the implementation. This fix is rather unexpected, as the current browsers do not fire "onsubmit" if you execute .submit() on a dom-level method, on the other hand the onsumbit event are triggered, when you actually "really" press the button (UI). I did not look at th W3C RFC, maybe that behavior is documentated / whished, but yet, its implementeted that way in all browsers. Let me sum this up

1. A button gets pressed in the browser ( UI )
- a event "onsubmit" is triggered, and all its handlers

2. $('subbutton').get(0).submit() is executed ( DOM method, not jquery)
- NO "onsubmit" event is generated

So, programmatically submitting a button properly means, triggering the event "onsubmit" manually - to be bullet proof to have the same "behavior" as pressing the button ( case 1 ).

Conclusioin:
- This yet cannot be considered a browser bug - or at least, its "buggy" in all browser then (bug would depend on what the RFC tells us )
- the need of this fix is unexpected somekind, but well, lets deal with that

esmerel’s picture

Yeah sorry, I didn't test anything but I thought the patch was against 7.x so I changed teh version. IF that was incorrect I apologize!

dawehner’s picture

Version: 7.x-3.x-dev » 6.x-3.x-dev
Status: Needs review » Patch (to be ported)

Let's move it to 6.x-3.x

Ctools 7.x-3.x has a rewritten js with at least a timeout for the textfield.

eugenmayer’s picture

just saying that it pretty much works well for the D6 branch, used it for nealry one year. Pitty i have to maintain a own D6 branch due to this issue .. anyway, i guess since the D7 patch needs to be done it cannot be applied by policy.

chris matthews’s picture

Status: Patch (to be ported) » Closed (outdated)

The Drupal 6 branch is no longer supported, please check with the D6LTS project if you need further support. For more information as to why this issue was closed, please see issue #3030347: Plan to clean process issue queue