r53937 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r53936‎ | r53937 | r53938 >
Date:14:14, 29 July 2009
Author:yaron
Status:deferred
Tags:
Comment:
Mandatory-radiobutton validation only called when necessary - F.trott's fix
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormPrinter.inc (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.inc
@@ -547,7 +547,8 @@
548548 $possible_values = array_map('trim', explode(',', $sub_components[1]));
549549 $possible_values = array_map('htmlspecialchars_decode', $possible_values);
550550 } elseif ($sub_components[0] == 'values from category') {
551 - $possible_values = SFUtils::getAllPagesForCategory($sub_components[1], 10);
 551+ $category_name = ucfirst($sub_components[1]);
 552+ $possible_values = SFUtils::getAllPagesForCategory($category_name, 10);
552553 } elseif ($sub_components[0] == 'values from concept') {
553554 $possible_values = SFUtils::getAllPagesForConcept($sub_components[1]);
554555 } elseif ($sub_components[0] == 'property') {
@@ -895,7 +896,10 @@
896897 } elseif (($form_field->template_field->is_list && $form_field->template_field->field_type == 'enumeration' && $input_type != 'listbox') || ($input_type == 'checkboxes')) {
897898 $sfgJSValidationCalls[] = "validate_mandatory_checkboxes('$input_id', '$info_id')";
898899 } elseif ($input_type == 'radiobutton') {
899 - $sfgJSValidationCalls[] = "validate_mandatory_radiobutton('$input_id', '$info_id')";
 900+ // only add this if there's a "None" option
 901+ if (is_null($default_value)) {
 902+ $sfgJSValidationCalls[] = "validate_mandatory_radiobutton('$input_id', '$info_id')";
 903+ }
900904 } else {
901905 $sfgJSValidationCalls[] = "validate_mandatory_field('$input_id', '$info_id')";
902906 }

Status & tagging log