I had a problem where after I hid the product fieldset new nodes were getting erroneously set as products. I looked into what formfilter was doing and I saw it was setting the value of the product radio button as the selected value rather than the default, which was null.
Examination of the code showed it was using
isset($element['#default_value'])
to test the existence of a default value. This does not work if the default is null. I've managed to fix this by a global change of the above expression to:
array_key_exists('#default_value', $element)
but it would be more correct to remove radio elements that have a default value of null from the form rather than hide them, to cope with the case where one of the alternatives is set by default. This fix only works if the overall value of the radio is null (or the equivalent) by default.
Comments
Comment #1
nedjoThanks for this note. I guess we also need to consider whether the element is required or not. I'd welcome a patch. Otherwise I'll get to this when I find time.
Comment #2
nedjoI suspect that a default of NULL is an error, since it's not a valid value, and that it should be fixed in the module setting it.
Comment #3
pianomansam commentedCleaning up old issues. D5 release is no longer supported.