First of all I want to mention I've looked into http://drupal.org/node/1516274. This issue doesn't seem to be related to mine though.
But with the latest development version I get flooded with undefined index errors whenever I try to save a content type that has a hierarchical select field:
Like twenty of _clientside_validation_set_title() more or sow ..........................................
- Notice: Undefined index: error in _clientside_validation_set_title() (regel 413 van /mnt/hgfs/www/mysite/www/sites/all/modules/contrib/clientside_validation/clientside_validation.module).
- Notice: Undefined index: include_hidden in _clientside_validation_add_general_settings() (regel 335 van /mnt/hgfs/www/mysite/www/sites/all/modules/contrib/clientside_validation/clientside_validation.module).
- Notice: Undefined index: include_hidden in _clientside_validation_add_general_settings() (regel 340 van /mnt/hgfs/www/mysite/www/sites/all/modules/contrib/clientside_validation/clientside_validation.module).
- Notice: Undefined index: error_placement in _clientside_validation_add_general_settings() (regel 344 van /mnt/hgfs/www/mysite/www/sites/all/modules/contrib/clientside_validation/clientside_validation.module).
- Notice: Undefined index: error_placement in _clientside_validation_add_general_settings() (regel 345 van /mnt/hgfs/www/mysite/www/sites/all/modules/contrib/clientside_validation/clientside_validation.module).
- Notice: Undefined index: include_hidden in _clientside_validation_add_general_settings() (regel 369 van /mnt/hgfs/www/mysite/www/sites/all/modules/contrib/clientside_validation/clientside_validation.module).
- Notice: Undefined index: error in _clientside_validation_add_general_settings() (regel 370 van /mnt/hgfs/www/mysite/www/sites/all/modules/contrib/clientside_validation/clientside_validation.module).
- Notice: Undefined index: error in _clientside_validation_add_general_settings() (regel 371 van /mnt/hgfs/www/mysite/www/sites/all/modules/contrib/clientside_validation/clientside_validation.module).
- Notice: Undefined index: validate_options in _clientside_validation_add_general_settings() (regel 373 van /mnt/hgfs/www/mysite/www/sites/all/modules/contrib/clientside_validation/clientside_validation.module).
- Notice: Undefined index: validate_options in _clientside_validation_add_general_settings() (regel 374 van /mnt/hgfs/www/mysite/www/sites/all/modules/contrib/clientside_validation/clientside_validation.module).
- Notice: Undefined index: validate_options in _clientside_validation_add_general_settings() (regel 375 van /mnt/hgfs/www/mysite/www/sites/all/modules/contrib/clientside_validation/clientside_validation.module).
- Notice: Undefined index: validate_options in _clientside_validation_add_general_settings() (regel 376 van /mnt/hgfs/www/mysite/www/sites/all/modules/contrib/clientside_validation/clientside_validation.module).
- Notice: Undefined index: validate_options in _clientside_validation_add_general_settings() (regel 377 van /mnt/hgfs/www/mysite/www/sites/all/modules/contrib/clientside_validation/clientside_validation.module).
- Notice: Undefined index: error in _clientside_validation_add_general_settings() (regel 378 van /mnt/hgfs/www/mysite/www/sites/all/modules/contrib/clientside_validation/clientside_validation.module).
After some research I came to the conclusion that somehow the settings for the form couldn't be loaded. But I'm unable to figure out why and how this function is handling it like that:
function clientside_validation_settings_current_form($settings = NULL) {
$current = &drupal_static(__FUNCTION__, array());
if (isset($settings)) {
$current = $settings;
if (isset($current['settings']) && is_array($current['settings'])) {
$current = $current['settings'];
}
}
return $current;
}
This sometimes returns an empty array which I think results in trowing the undefined errors whenever a hierarchical select field is present. Until here I'm at a dead end because I really can't grasp the way the settings are set each time...
Any help is appreciated.
Comment | File | Size | Author |
---|---|---|---|
#17 | Bildschirmfoto 2012-05-24 um 07.57.03.png | 24.68 KB | ak |
#17 | Bildschirmfoto 2012-05-24 um 07.57.58.png | 32.72 KB | ak |
#8 | clientside-validation-check-hs-req-message-1570408-8.patch | 1.35 KB | alexverb |
#1 | clientside-validation-return-default-settings-as-default-1570408-2.patch | 984 bytes | alexverb |
Comments
Comment #1
alexverb CreditAttribution: alexverb commentedSetting the default settings in drupal_static instead of an empty array does seem to fix this problem.
Comment #2
attiks CreditAttribution: attiks commentedYour diagnose is right, the errors are coming from an empty array, but it shouldn't be empty since it's set inside clientside_validation_form_alter.
Can you debug this a bit further:
1/ Can you check the settings at admin/config/validation/clientside_validation/default, save them and try again
2/ if it still doesn't work add "dpm($definedsettings)" (you'll need the devel module) after lines 206 and 209 inside clientside_validation.module and try again. Let me know which got called and the output.
Cheers
Comment #3
attiks CreditAttribution: attiks commentedForget to ask, did you run update.php after installing the latest version?
Comment #4
alexverb CreditAttribution: alexverb commentedI did run updb and got the new table for the settings. But when saving the defaults the table stays empty correct? Also when saving the defaults I got several notices like these:
After enabling the Clientside Validation HTML5 module this notice was solved. Probably has nothing to do with this issue... Just thought I would mention it.
So after this I went back to the debugger. When loading the form I go past line 206 and get the settings for my node form as expected. Clientside validation is working properly on my node form. But when submitting I seem to go through the same motion of passing without ever passing by line 206.
I have a sneaky suspicion ajax callbacks are messing up the loading of the settings. Because when switching the widget type from HS to select and back (also works by ajax) I get the following tantrum:
I think ajax_form_callback() may not pass 206 and 209 but still puts the #after_build function on? Which somehow results in an empty array...
Anywayz, I'm curious what you're thoughts are on this. I've done enough debugging for one evening.
Comment #5
attiks CreditAttribution: attiks commented@Alex, thanks for the debugging.
But when saving the defaults the table stays empty correct? Yes
And yes AJAX still knows about the #after_build functions, I was afraid this could be a problem while implementing the settings, we'll need to find a proper way to attach the settings to the form without using a global function.
Comment #6
Jelle_Sfixed in the latest dev version
Comment #7
alexverb CreditAttribution: alexverb commentedI don't know if I should open a new issue for this but the update in dev causes a new undefined index error on my hierarchical selects:
Seems like the new check on a hierarchical select is the culprit. It also destroys the ajax callback of HS. I don't really understand why there should be a "required" validation on it when my hierarchical selects aren't required.
Comment #8
alexverb CreditAttribution: alexverb commentedWhen I make the field required, the undefined index error is gone. So I guess a simple check would suffise. See patch. Or does _clientside_validation_set_blacklist() do something with that message?
Comment #9
alexverb CreditAttribution: alexverb commentedForgot to change status.
Comment #10
attiks CreditAttribution: attiks commentedPatch applied to latest dev. The required is set if enforce_deepest is set, but I'll have to talk to Jelle_S to see if this is the right approach.
Comment #11
Jelle_SRequired is set on the first dropdown of hierarchical select if the element is required.
Then, if enforce_deepest is set, required is set on all dropdowns of that hierarchical select. Fixed in latest dev.
Comment #12
ak CreditAttribution: ak commentedI tried using the current dev version and I get following php error with my hierarchical select taxonomy field:
(Notice: Undefined index: field_country[und] in clientside_validation_regular() (line 172 of … /clientside_validation_form.module))
Comment #13
attiks CreditAttribution: attiks commentedFixed in latest dev, there was a typo, can you check if it's working?
Comment #14
ak CreditAttribution: ak commentedThe PHP Error has gone away.
But, the clientside validation doesn't seem to work. My hs-box doesn't show any errors.
Comment #15
attiks CreditAttribution: attiks commentedComment #16
Jelle_SCan you post a screenshot of your field settings and of the HS settings?
Comment #17
ak CreditAttribution: ak commentedHi there, I previosly had this field set to "Exclude from clientside validation" because of the PHP Error. However, switching this setting off again has no effect.
I can see the field listed in Drupal.settings array though:
My clientside validation error placement is set to display "before input". I temporary switched this to "top of form" to duble check this is not an issue, but theres no error message displayed in either way. See Screenshots of my field settings attached.
Comment #18
Jelle_Sok, fixed in latest dev. The problem was that the select html value is different when you define your own label in the settings, or when you don't define a label
Comment #19
Jelle_S