I have client-side validation installed the latest dev version 7.x-1.37+26-dev.
I assumed it was a good idea to enable it for all forms.
However whenever a form has built-in drupal AJAX requests and makes a request to the server for updated data Client-side Validation is unable to understand what is happening and prevents the AJAX request from happening.
For example this happens when using Commerce Shipping or Billing. It is possible to send a drupal AJAX request to retrieve existing shipping or billing addresses but Client-side Validation only sees empty fields and a change in the form state taking place and prevents the AJAX request from executing.
Another example is within the Admin configuration of rules when you want to switch from entering a field value to Data Selectors, Client-side Validation only sees an empty field and a change in the form state and prevents the AJAX request from executing.
There are other places where I have seen this problem and the solution every time is disabling Client-side Validation on the form which then allows the AJAX requests to be executed.
I do not think this is a problem restricted to one or two specific forms This seems to be a general problem with Client-side Validation and the execution of Drupal AJAX requests.
I do want Clientside Validation on the forms I have mentioned but I also definitely want AJAX as it makes the site much more user friendly. I cant figure how to enable Client-side Validation and have the drupal AJAX requests execute as and when needed.
Is this a bug or is there a configuration of Client-side Validation that allows drupal AJAX requests?
Comments
Comment #1
attiks CreditAttribution: attiks commentedWe added some extrra code to support AJAX, but apparently it isn't fully tested, see the following commits:
http://drupalcode.org/project/clientside_validation.git/commit/775b481
http://drupalcode.org/project/clientside_validation.git/commit/f71cada
http://drupalcode.org/project/clientside_validation.git/commit/4bf5b2d
If you could try debugging this, that would be awesome, I'll ask Jelle_S to have a look next week as well.
Comment #2
Jelle_SIf added a (partial) fix where submit buttons with '#limit_validation_errors' => array() won't trigger clientside validation. This fixes the Rules form you mentioned. I'm not sure how to fix the commerce forms yet.
Comment #3
nils.destoop CreditAttribution: nils.destoop commentedThis problem still occurs on latest dev. I have a simple textfield that triggers an ajax request. The request is never happening untill the clientside validation passes.
Comment #4
whatdoesitwant CreditAttribution: whatdoesitwant commentedComment #5
attiks CreditAttribution: attiks commentedProbably caused by http://drupalcode.org/project/clientside_validation.git/blobdiff/8ce6597... can you try removing the Drupal.behaviors.ZZZClientsideValidation and see if the problem still exists.
Comment #6
nils.destoop CreditAttribution: nils.destoop commentedRemoving Drupal.behaviors.ZZZClientsideValidation fixes the problem for me.
Comment #7
attiks CreditAttribution: attiks commented@Jelle_S can you add an option to enable/disable this behavior?
Comment #8
Jelle_SThe setting has been added and defaults to 'off', as it has been known to cause issues. It was added to support CTools Modal forms, which is more of an edge case than a general case. Because of that it seems like a good idea (to me) to disable it by default.
Comment #10
dahousecat CreditAttribution: dahousecat commentedI had the same problem and removing Drupal.behaviors.ZZZClientsideValidation from the js file worked for me too.
Comment #11
padma28 CreditAttribution: padma28 commentedI have removed Drupal.behaviors.ZZZClientsideValidation from js file, worked for me. But, after serverside validation on the page, not getting form_id and my custom submit function is also not working.
Comment #12
padma28 CreditAttribution: padma28 commentedI have tried one custom rule for a name field, FAPI + Clientside validation.
I've used the below code, but its not working.
Any help would be greatly appreciated, thanks!
Comment #13
attiks CreditAttribution: attiks commented#12 Can you create a new issue for this please?
Comment #14
padma28 CreditAttribution: padma28 commented@attiks Thanks fixed #12 using the documentation at https://drupal.org/node/1324772
Comment #15
quironmaybe this can be useful: https://www.drupal.org/node/2669646