I use matrix together with conditionals depending on radio button.

If radio button is selected to Yes, then show matrix
If matrix is hidden and hit submit button, then there is warning fired in _webform_submit_matrix in line

$keys = array_keys( $value );

Warning: array_keys() expects parameter 1 to be array, null given in _webform_submit_matrix() (line 454

Warning: Invalid argument supplied for foreach() in _webform_submit_matrix() (line 455

Version is 7.x-7.22

Need to add check for $value to prevent Warning

>> function _webform_submit_matrix($component, $value) {
>>
>>
>> $form_key = $component['form_key'];
>>
>> if (isset($value['add_row_'.$form_key])) {
>> unset($value['add_row_'.$form_key]);
>> }
>> if (isset($value['remove_row_'.$form_key])) {
>> unset($value['remove_row_'.$form_key]);
>> }
>>
>> $keys = array_keys( $value );
>> foreach ( $keys as $key ) {
>> if ( preg_match( '/remove_row_line_'.$form_key.'_.$/', $key ) ) {
>> unset($value[$key]);
>> }
>> }
>>
>> return serialize($value);
>> }

Comments

twin84 created an issue. See original summary.

chetan-singhal’s picture

fixed

chetan-singhal’s picture

Status: Active » Fixed

fixed

chetan-singhal’s picture

Status: Fixed » Closed (fixed)