I just discovered that "Hide submit button" does not work with the "Clientside validation" module.

Basically, when using both modules and there is an error on one of the form fields. The clientside validation module shows the field errors to the user (using javascript) which is of course what it is supposed to do.... The problem is, since this error check is done on the client's side and not the server, the page is not reloaded. Therefore, the submit button stays hidden and the "Please wait" message continues.... forever.... Thus preventing the user from being able to submit the form once the fields are corrected.

Obviously, this is pretty minor (simply don't use BOTH modules at the same time) but I wanted to report this issue.

I am not overly familiar with javascript and jQuery, otherwise I would attempt to fix the issue myself. But perhaps some sort of check could be done to "reset" the submit button back to visible if the clientside validation is triggered? Just a thought....

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rafamd’s picture

I wonder if there would be a solution for all ajax/js validated forms in general instead of just catering for clientside_validation module. Anyway, it would be very nice to play well with that module.

ggmacasaet’s picture

reopening this issue. hope you could assist on how to deactivate the hide submit if there are errors on the form like mandatory fields and stuff

greggles’s picture

Are you using the 7.x-1.x or 7.x-2.x version?

I wonder if there is a "hook" like concept for javascript so that other scripts could be polled for whether or not the form is ready to submit.

ggmacasaet’s picture

i am using the 7.x-2.x version.

greggles’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev

OK, great to know. Now we just need to figure out how to take specific actions based on the client side validation somehow.

I wonder if client side validation has a mode to disable the button until all validation passes - then this module can only fire if the validation already passes.

greggles’s picture

Another idea that would solve this is #1847578: show submit button again after 5 or 10 seconds

attiks’s picture

Status: Active » Needs review
FileSize
2.09 KB

Attached patch fixes this for the latest version of clientside_validation

ThomWilhelm’s picture

Hi attiks, I just came across this same issue today, so I tried out your patch (which works nicely).

Only bug I found was that if I disabled the "Use fade effects?" setting when I choose to hide the submit button, then the button dissapears immediately when their are errors on clientside_validation. Not sure if you can replicate this?

attiks’s picture

FileSize
421 bytes
2.23 KB

You're right, should be fixed

ThomWilhelm’s picture

Awesome thanks that new patch fixes the issue for me. Be great when both of these patches are in the current releases. Thanks again for your help.

greggles’s picture

Thanks for the work on this, attiks, and the review, ThomWilhelm.

I'm hesitant to commit this without also fixing #1842700: Improve compability with autocomplete and attachBehaviour improvements. Any chance you could review that patch and make sure both apply?

Edited to be the right issue

greggles’s picture

Whoops, #11 originally pointed to the wrong issue. I meant #1842700: Improve compability with autocomplete and attachBehaviour improvements.

attiks’s picture

FileSize
6.96 KB
6.78 KB

New patch including elements from #1842700: Improve compability with autocomplete and attachBehaviour improvements and I added support for a timeout after which the buttons are reset, solving #1847578: show submit button again after 5 or 10 seconds.

greggles’s picture

Status: Needs review » Fixed

Fixed - http://drupalcode.org/project/hide_submit.git/commit/cf3b1a9

Thanks, attiks and ThomWilhelm!

I'll probably roll a new release in about 2 weeks so that this can have some time to get tested in the 7.x-2.x-dev.

greggles’s picture

Title: Conflict with Clientside Validation module. » Javascript cleanup: Conflict w/ clientsidevalidation, compatibility w/ autocomplete & attachBehaviour, show button again

Updated title to reflect what this issue really fixed.

Status: Fixed » Closed (fixed)

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

mjade1138’s picture

I am having this exact problem, only on a Drupal 6 site. I'm currently using the module version 6.x-1.12, which is the most recent available to D6. How can I solve this problem?

mibfire’s picture

Issue summary: View changes

It doesnt work for me. When there are clientside validation errors, submit will be disabled, and after i fixed all errors the disabled attribute wont be removed.

modules:

hide submit button 7.x-2.0+0-dev
Clientside Validation 7.x-1.37
Jquery 1.7

mibfire’s picture

Status: Closed (fixed) » Active
martichka5’s picture

Hi,

I am adding a new patch that solves hide submit and clientside validation conflict. In our case we use Workflow module, too. So, on node edit form we have two buttons: Save as draft(where we want to skip validation) and Save(where we want validation). We change the name attribute of the Save as draft button.

The issue can be reproduced in the following steps:
1. Enter Save button without entering all data/any data
2. Clientside validation module set errors and the form is not submitted
3. After that enter Save as draft

But here Drupal "think" that the triggered element is again the Save button.
So, i notice that hide_submit module is creating new hidden input with the same name=op as the last pressed button(Save). But on hideSubmitResetButtons function in the javascrit, this input and the settings.hide_submit_css class are not removed.
Hide submit button module create this hidden input with the same name attribute as the pressed button.

So, the patch removes the input and the class and Drupal get the right clicked button after failing validation and we can skip it in the draft case.

We are using the following module versions:
Workflow 7.x-2.x
Hide Submit Button 7.x-2.0
Clientside Validation 7.x-1.x
JQuery 1.7

skulegirl’s picture

FileSize
440 bytes

I have the most recent versions of both hide_submit (7.x-2.0+1-dev) and clientside_validation (7.x-1.41) and this still doesn't work. Looking at the code (and I am far from a javascript expert), I can see that hide_submit.js has the call to hideSubmitResetButtons commented out in the clientsideValidationFormHasErrors binding. If I uncomment this, things work as I expected. Perhaps this was an oversight when checking in code?

greggles’s picture

Status: Active » Needs review

Anyone else able to review #21?

Anonymous’s picture

The line is still commented out.

eric.chenchao’s picture

#21 works for me. My use case is when Drupal commerce checkout form fails in form validation, either my custom js or clientside_validation will trigger a "clientsideValidationFormHasErrors" event to let hide_submit.js to reset submit button.

Module version: 7.x-2.0

eric.chenchao’s picture

Status: Needs review » Reviewed & tested by the community
bgilhome’s picture

FileSize
328 bytes

#21 works for me. Here's an updated patch against the latest dev.

eric.chenchao’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
1.33 KB

I also found that the following bugs when using hide_submit together with clientside_validation and form ajax:

hide_submit will create hidden element with the name and value of clicked button. But this hidden element will never be cleaned. So when client side validation fails, you can click submit button again and a duplicate hidden element will be created. This leads to multiple hidden elements.

It gets worse when you trigger an ajax event with non-button type element like select or checkbox for example later. As hidden element has not been cleaned, the hidden value of button will be accidently posted to remote server in an Ajax event which is not supposed to be. When button value is posted, Drupal will override original triggering element (say a radio element) in drupal_build_form()and use this button as new triggering element instead. And all validation and submit handlers of the original triggering element will never be executed.

I have attached a new patch and fix my problem. This patch is against the latest hide_submit version.

eric.chenchao’s picture

Add check to make sure hidden element will only be created once.

dmsmidt’s picture

Patch #28 worked, I did some additional cleanup and some stricter checking.

NWOM’s picture

#29 does not apply to 7.x-2.x-dev, however #28 does. It appears the patch in #29 was not created against 7.x-2.x-dev HEAD and would require a reroll.

NWOM’s picture

Status: Needs review » Needs work
sjerdo’s picture

Seems like @dmsmidt applied the wrong patch. The patch equals the interdiff.
I experienced JS errors with patch #29 when the submit button contains spaces and/or exclamation marks. I have added a new patch with double quotes wrapping the name and value of the button in the selector.

firewaller’s picture

Status: Needs review » Reviewed & tested by the community

#32 patch applied cleanly and worked for me when I was experiencing an issue with this module conflicting with clientside_validation.