Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Fresh drupal install for testing this.
I have a very simple page view with an exposed filter for search terms with ajax enabled.
when I create a template file for the exposed filter and move the reset button above the submit button the reset button now throws an ajax error.
why does changing the button order cause such problems and has any found a fix/workaround for this issue?
original:
<div class="views-exposed-widget views-submit-button">
<?php print $button; ?>
</div>
<?php if (!empty($reset_button)): ?>
<div class="views-exposed-widget views-reset-button">
<?php print $reset_button; ?>
</div>
<?php endif; ?>
changed:
<?php if (!empty($reset_button)): ?>
<div class="views-exposed-widget views-reset-button">
<?php print $reset_button; ?>
</div>
<?php endif; ?>
<div class="views-exposed-widget views-submit-button">
<?php print $button; ?>
</div>
and here is the ajax error:
An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /drupal_sandbox/views/ajax
StatusText: OK
ResponseText:
Site-Install
@import url("http://localhost/drupal_sandbox/modules/system/system.base.css?ob1ie5");
@import url("http://localhost/drupal_sandbox/modules/system/system.menus.css?ob1ie5");
@import url("http://localhost/drupal_sandbox/modules/system/system.messages.css?ob1ie5");
@import url("http://localhost/drupal_sandbox/modules/system/system.theme.css?ob1ie5");
@import url("http://localhost/drupal_sandbox/modules/comment/comment.css?ob1ie5");
@import url("http://localhost/drupal_sandbox/modules/field/theme/field.css?ob1ie5");
@import url("http://localhost/drupal_sandbox/modules/node/node.css?ob1ie5");
@import url("http://localhost/drupal_sandbox/modules/search/search.css?ob1ie5");
@import url("http://localhost/drupal_sandbox/modules/user/user.css?ob1ie5");
@import url("http://localhost/drupal_sandbox/sites/all/modules/views/css/views.css?ob1ie5");
@import url("http://localhost/drupal_sandbox/sites/all/modules/ctools/css/ctools.css?ob1ie5");
@import url("http://localhost/drupal_sandbox/sites/all/modules/panels/css/panels.css?ob1ie5");
@import url("http://localhost/drupal_sandbox/sites/all/themes/boilerplate/css/compiled/style.css?ob1ie5");
@import url("http://localhost/drupal_sandbox/sites/all/themes/boilerplate/css/compiled/ie8.css?ob1ie5");
@import url("http://localhost/drupal_sandbox/sites/all/themes/boilerplate/css/compiled/ie7.css?ob1ie5");
@import url("http://localhost/drupal_sandbox/sites/all/themes/boilerplate/css/compiled/ie6.css?ob1ie5");
You are using an outdated browser. Please upgrade your browser or activate Google Chrome Frame to improve your experience.
Jump to Navigation
Site-Install
Home
hello
Type
- Any -ArticleBasic page
Search Terms
test smurf page
test page 2
test page 1
User login
Username *
Password *
Create new account
Request new password
Powered by Drupal
Comment | File | Size | Author |
---|---|---|---|
#8 | views-moving_reset_button_in_exposed_filter_te-2774967-8.patch | 630 bytes | Andrew Answer |
| |||
#5 | no_resets-2774967-5.patch | 658 bytes | Anonymous (not verified) |
|
Comments
Comment #2
dave.erwin CreditAttribution: dave.erwin commentedComment #3
dave.erwin CreditAttribution: dave.erwin commentedComment #4
dave.erwin CreditAttribution: dave.erwin commentedI'm looking at the code in ajax_view.js
it's setting var button to the first submit in the exposed form, which is the reset button if it's moved ahead of the submit.
I realize it's bad practice to move the reset before the submit due to browser behavior when hitting enter key, wondering if a better solution would be to change the type of the reset from a submit to type="reset"?
Comment #5
Anonymous (not verified) CreditAttribution: Anonymous at Cheeky Monkey Media commentedI created a patch to not include reset buttons when attaching exposed form ajax.
Comment #6
Anonymous (not verified) CreditAttribution: Anonymous at Cheeky Monkey Media commentedLooks like this is a potential duplicate of https://www.drupal.org/node/1109980
Comment #7
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedThe 2 year old patch in #5 to ajax_view.js does not apply to the latest views 7.x-3.x-dev.
Comment #8
Andrew Answer CreditAttribution: Andrew Answer as a volunteer commentedPatch rerolled.