This works like a charm except on multi-page webforms where some of the pages don't have conditionals.
Error: "d is null"
Steps to reproduce:
1) Create a webform with three fields
2) Insert a pagebreak between the first two
3) Make the third field conditional on the second
4) View the first "page" of the webform, and you'll notice jQuery is totally broken
I noticed the variables at the head of the document were giving a predictable value when viewing a page without conditionals. This helped with a simple fix:
$(document).ready(function() {
+ if (webform_conditional != null) {
$.each(webform_conditional, function(dependentField, dependentInfo) {
var formItemWrapper = webform_condtional_wrapper(dependentField,dependentInfo);
formItemWrapper.css("display", "none");
// Add onclick handler to Parent field
webform_conditional_add_onchange(dependentField, dependentInfo);
});
+ }
});
Comments
Comment #1
tedbowThe JavaScript has been totally rewritten, should be fixed now.