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....
Comment | File | Size | Author |
---|---|---|---|
#32 | interdiff-1378110-28-32.txt | 2.35 KB | sjerdo |
#32 | hide_submit-conflict-with-clientsidevalidation-1378110-32.patch | 2.87 KB | sjerdo |
Comments
Comment #1
rafamd CreditAttribution: rafamd commentedI 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.
Comment #2
ggmacasaet CreditAttribution: ggmacasaet commentedreopening 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
Comment #3
gregglesAre 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.
Comment #4
ggmacasaet CreditAttribution: ggmacasaet commentedi am using the 7.x-2.x version.
Comment #5
gregglesOK, 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.
Comment #6
gregglesAnother idea that would solve this is #1847578: show submit button again after 5 or 10 seconds
Comment #7
attiks CreditAttribution: attiks commentedAttached patch fixes this for the latest version of clientside_validation
Comment #8
ThomWilhelm CreditAttribution: ThomWilhelm commentedHi 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?
Comment #9
attiks CreditAttribution: attiks commentedYou're right, should be fixed
Comment #10
ThomWilhelm CreditAttribution: ThomWilhelm commentedAwesome 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.
Comment #11
gregglesThanks 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
Comment #12
gregglesWhoops, #11 originally pointed to the wrong issue. I meant #1842700: Improve compability with autocomplete and attachBehaviour improvements.
Comment #13
attiks CreditAttribution: attiks commentedNew 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.
Comment #14
gregglesFixed - 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.
Comment #15
gregglesUpdated title to reflect what this issue really fixed.
Comment #17
mjade1138 CreditAttribution: mjade1138 commentedI 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?
Comment #18
mibfire CreditAttribution: mibfire commentedIt 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
Comment #19
mibfire CreditAttribution: mibfire commentedComment #20
martichka5 CreditAttribution: martichka5 commentedHi,
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
Comment #21
skulegirl CreditAttribution: skulegirl commentedI 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?
Comment #22
gregglesAnyone else able to review #21?
Comment #23
Anonymous (not verified) CreditAttribution: Anonymous commentedThe line is still commented out.
Comment #24
eric.chenchao CreditAttribution: eric.chenchao commented#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
Comment #25
eric.chenchao CreditAttribution: eric.chenchao commentedComment #26
bgilhome CreditAttribution: bgilhome commented#21 works for me. Here's an updated patch against the latest dev.
Comment #27
eric.chenchao CreditAttribution: eric.chenchao commentedI 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.
Comment #28
eric.chenchao CreditAttribution: eric.chenchao commentedAdd check to make sure hidden element will only be created once.
Comment #29
dmsmidtPatch #28 worked, I did some additional cleanup and some stricter checking.
Comment #30
NWOM CreditAttribution: NWOM commented#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.
Comment #31
NWOM CreditAttribution: NWOM commentedComment #32
sjerdoSeems 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.
Comment #33
firewaller CreditAttribution: firewaller commented#32 patch applied cleanly and worked for me when I was experiencing an issue with this module conflicting with clientside_validation.