I enable clientside_validation and clientside_validation_webform module to validation the webform of my site. But I found the range valiatation does not work. And I found out that is because the clientside_validation_webform module does not pass the name of the field to the clientside correctly. It just set the name to 'submitted[%form_key]', but the form element might have a parent, like fieldset. So, the name of the element should be like 'submitted[personal_info][family_name]'.
Comments
Comment #1
attiks commentedYou set the name your self, or do you mean the name generated by webform?
Which version of webform?
Any other modules enabled that interact with webforms?
Comment #2
yang.wilby commentedI mean, the client side validation functionality is using the jquery validation plugin. The jquery validation plugin reads the configuration information including which fields needing the client side validation in the ' Drupal.settings.clientsideValidation ' object and does the work. If the form is generated by the webform, the name attribute of a field needing validation under a fieldset is passed to the client side using 'submitted[form_key]'. Its parent's form key is left out. It should be 'submitted[field_set_form_key][form_key]' to work well. You can check the code of clientside_validation_webform.module. It is about the first parameter of the function _clientside_validation_set_minmax, and so on.
Comment #3
attiks commentedDid you try the dev version? That version is running at http://validation6.ubu001.attiks.com/node/1 and I added a fieldset to make sure it works.
Comment #4
yang.wilby commentedyeah, it works because the validation rule in the demo is just a normal and regular one (a field is required). The clientside_validation_webform module can do more. It can read the validation rule set by using the webform_validation module. When the validation is not a regular one, like a number must be in a range, It does not work. Because the name attribute of the form element is not passed to the client side correctly. Please check the codes of clientside_validation_webform.module. It is about the first parameter of function _clientside_validation_set_minmax, and so on.
Comment #5
attiks commentedso you're using webform_validation module, i'll try to test it later today
Comment #6
yang.wilby commentedThank you very much - await your reply. As you are the owner, you are more familiar with all of the codes. I know how to fix the bug, but maybe we can check together and find out a better way to fix the bug.
Comment #7
attiks commentedI can reproduce it, will look for a fix.
Comment #8
attiks commentedFixed in dev version, you'll have to wait at least 12 hours or use git clone to get the changes.
Comment #9
attiks commentedNeeds to be ported to 7
Comment #10
attiks commentedfixed in 7 and 8
Comment #11
yang.wilby commentedWhen using 6.x-1.x-dev, an error occurs, saying
"Allowed memory size of 134217728 bytes exhausted (tried to allocate 523800 bytes) in /var/www/drupal/sites/all/modules/contrib/clientside_validation/clientside_validation_webform/clientside_validation_webform.module on line 196 "
It seems there are problems with the recursive function named clientside_validation_webform_webform_validation_add_names
Comment #12
attiks commentedCan you try increasing your memory, just as a test to make sure this is the problem, I didn't have the time to test the memory impact, but it shouldn't be that bad.
I'm probably not going to have time this week to debug it ...
Comment #13
attiks commentedComment #14
jelle_sI cannot seem to reproduce this error, so I think it will be your memory limit indeed. Do you have any idea how high/low it is set?
Edit:
Sorry, I was testing on the 7.x version. I get the same kind of error in 6.x:
Comment #15
jelle_sThe reason for this error was that we accidently named a function according to a webform_validation hook. Fixed in both 6.x and 7.x
Comment #16
yang.wilby commentedwhich function? what is its original function name?
Comment #17
attiks commentedSee http://drupalcode.org/project/clientside_validation.git/blobdiff/9ee6c5e...
clientside_validation_webform_webform_validation is renamed to _clientside_validation_webform_webform_validation