Index: trunk/extensions/SemanticForms/includes/SF_FormInputs.inc |
— | — | @@ -96,7 +96,7 @@ |
97 | 97 | $size = 35; |
98 | 98 | } |
99 | 99 | if ($validation_type_str != '') { |
100 | | - if ($other_args['part_of_multiple']) { |
| 100 | + if (array_key_exists('part_of_multiple', $other_args)) { |
101 | 101 | $sfgJSValidationCalls[] = "validate_type_of_multiple_fields($sfgFieldNum, '$validation_type_str')"; |
102 | 102 | } else { |
103 | 103 | $sfgJSValidationCalls[] = "validate_field_type('$input_id', '$validation_type_str', '$info_id')"; |
— | — | @@ -150,8 +150,8 @@ |
151 | 151 | $info_id = "info_$sfgFieldNum"; |
152 | 152 | $disabled_text = ($is_disabled) ? "disabled" : ""; |
153 | 153 | $javascript_text = ''; |
154 | | - $return_js_text; |
155 | | - if (count($other_args['show on select']) > 0 ) { |
| 154 | + $return_js_text = ''; |
| 155 | + if (array_key_exists('show on select', $other_args)) { |
156 | 156 | $javascript_text = 'onChange="'; |
157 | 157 | foreach ($other_args['show on select'] as $div_id => $options) { |
158 | 158 | $options_str = implode("', '", $options); |
— | — | @@ -229,7 +229,7 @@ |
230 | 230 | |
231 | 231 | $javascript_text = ''; |
232 | 232 | $return_js_text; |
233 | | - if (count($other_args['show on select']) > 0 ) { |
| 233 | + if (array_key_exists('show on select', $other_args)) { |
234 | 234 | $javascript_text = 'onChange="'; |
235 | 235 | foreach ($other_args['show on select'] as $div_id => $options) { |
236 | 236 | $options_str = implode("', '", $options); |
— | — | @@ -322,11 +322,13 @@ |
323 | 323 | END; |
324 | 324 | |
325 | 325 | $return_js_text = ''; |
326 | | - if (count($other_args['show on select']) > 0) { |
| 326 | + if (array_key_exists('show on select', $other_args)) { |
327 | 327 | foreach ($other_args['show on select'] as $div_id => $options) { |
328 | 328 | $cur_input_ids = array(); |
329 | 329 | foreach ($options as $option) { |
330 | | - $cur_input_ids[] = $enum_input_ids[$option]; |
| 330 | + if (array_key_exists($option, $enum_input_ids)) { |
| 331 | + $cur_input_ids[] = $enum_input_ids[$option]; |
| 332 | + } |
331 | 333 | } |
332 | 334 | $options_str = "['" . implode("', '", $cur_input_ids) . "']"; |
333 | 335 | $cur_js_text = "showIfChecked($options_str, '$div_id'); "; |
— | — | @@ -533,7 +535,7 @@ |
534 | 536 | $input_id = "input_$sfgFieldNum"; |
535 | 537 | $info_id = "info_$sfgFieldNum"; |
536 | 538 | // add to validation calls |
537 | | - if ($other_args['part_of_multiple']) { |
| 539 | + if (array_key_exists('part_of_multiple', $other_args)) { |
538 | 540 | $sfgJSValidationCalls[] = "validate_type_of_multiple_fields($sfgFieldNum, 'date')"; |
539 | 541 | } else { |
540 | 542 | $sfgJSValidationCalls[] = "validate_field_type('$input_id', 'date', '$info_id')"; |
— | — | @@ -656,7 +658,7 @@ |
657 | 659 | $check_set = false; |
658 | 660 | $javascript_text = ''; |
659 | 661 | $return_js_text = ''; |
660 | | - if (count($other_args['show on select']) > 0) { |
| 662 | + if (array_key_exists('show on select', $other_args)) { |
661 | 663 | $javascript_text = 'onClick="'; |
662 | 664 | foreach($other_args['show on select'] as $div_id => $options) { |
663 | 665 | $options_str = implode("', '", $options); |
— | — | @@ -718,7 +720,7 @@ |
719 | 721 | $input_id = "input_$sfgFieldNum"; |
720 | 722 | $disabled_text = ($is_disabled) ? "disabled" : ""; |
721 | 723 | $return_js_text = ''; |
722 | | - if (count($other_args['show on select'] > 0)) { |
| 724 | + if (array_key_exists('show on select', $other_args)) { |
723 | 725 | $div_id = key($other_args['show on select']); |
724 | 726 | $this_js_text = "showIfChecked(['$input_id'], '$div_id');"; |
725 | 727 | // we use addClickHandler(), instead of adding the Javascript via |
Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.inc |
— | — | @@ -618,9 +618,11 @@ |
619 | 619 | } |
620 | 620 | } |
621 | 621 | } |
622 | | - } // for |
623 | | - $field_args['part_of_multiple'] = $allow_multiple; |
624 | | - $field_args['show on select'] = $show_on_select; |
| 622 | + } // end for |
| 623 | + if ($allow_multiple) |
| 624 | + $field_args['part_of_multiple'] = $allow_multiple; |
| 625 | + if (count($show_on_select) > 0) |
| 626 | + $field_args['show on select'] = $show_on_select; |
625 | 627 | // get the value from the request, if it's there, and if it's not |
626 | 628 | // an array |
627 | 629 | $escaped_field_name = str_replace("'", "\'", $field_name); |
— | — | @@ -847,7 +849,7 @@ |
848 | 850 | wfRunHooks('sfCreateFormField', array(&$form_field, &$cur_value, false)); |
849 | 851 | // if this is not part of a 'multiple' template, increment the |
850 | 852 | // global tab index (used for correct tabbing) |
851 | | - if (! $field_args['part_of_multiple']) |
| 853 | + if (! array_key_exists('part_of_multiple', $field_args)) |
852 | 854 | $sfgTabIndex++; |
853 | 855 | // increment the global field number regardless |
854 | 856 | $sfgFieldNum++; |