While working with the beta2 version today, we noticed that there was a conflict with the AJAX filter form submit in the Views module.

I noticed that you wrote that :

The 6.x-1.x release adds configurations that can overcome such conflicts by excluding forms or buttons from the script.

Is this a feature that can be added to the full 7.x-2.x release?

Thanks!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

greggles’s picture

Category: feature » support
Status: Active » Fixed

The README.txt and hide_submit.api.php describe how you can achieve this with a little bit of code. I think a sub-module that provides this feature would be great if you want to work on it. I purposefully don't plan to add this feature to the base 7.x-2.x module.

If you look at the size of the codebase you see:
6.x-1.x: 729 lines of code across php, js, css - 22% comments.
7.x-1.x: (with bugs that need to be fixed -i.e. may grow.) 730 lines of code - 21% comments
7.x-2.x: 150 lines of code - 34% comments.

The 7.x-2.x branch is alterable in code but purposefully doesn't have a ton of features in the interface. First, I think most people don't need those features and they are just confusing in the admin area. Second, it's easier to maintain a module if it does fewer things.

So...please take a read in the api and let me know if you have any questions as you write the code by re-opening the issue. If you can write a sub-module to do this that is generalized and you want to contribute as a tarball that would be great - please re-open this issue and change it back to a feature request.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

mstef’s picture

Status: Closed (fixed) » Active

Correct me if I'm wrong please, but I only see 1 hook: hook_hide_submit_alter(). Yes that allows us to disable it on a given page, but how about for a given form (like this issue says)? I don't see that being possible with this hook. Is there something I'm missing?

greggles’s picture

Title: Exclude Forms or Buttons Request » Exclude forms or buttons when there are multiple buttons on one page
Category: support » feature

Yeah, I think you're right that it's possible to disable/enable it for a specific path but it's not possible to disable/enable for a specific form.

That seems like a very reasonable idea so I'm updating the title and metadata of this issue to reflect that. I don't personally need it so I won't be working on it, but I'd be happy to review a patch.

greggles’s picture

This was much more difficult to accomplish before #1941592: Get rid of hook_init to improve performance but it should now be more straightforward to pass along the form_id to the settings and update the javascript to be more specific to certain form-id values.

vladan.me’s picture

Version: 7.x-2.0-beta2 » 7.x-2.x-dev
Issue summary: View changes
FileSize
1.22 KB

I'm just wondering if this is the right approach? It seems to solve my very specific usage, but likely is not a general solution to this issue.

vincentdemers’s picture

FileSize
760 bytes

The previous patch did not work for me.

This new patch allows to set a class on the $form element to disable hide_submit entirely in the form API.
Ex

$form['#attributes']['class']=array(0=>'exclude-hide-submit');