[Fusionforge-commits] r14807 - in branches/Branch_5_1: . src/www/include

Roland Mas lolando at fusionforge.org
Wed Nov 16 15:39:54 CET 2011


Author: lolando
Date: 2011-11-16 15:39:54 +0100 (Wed, 16 Nov 2011)
New Revision: 14807

Modified:
   branches/Branch_5_1/
   branches/Branch_5_1/src/www/include/html.php
Log:
Merged from Evolvis: fix XHTML: prevent <select></select> without <option/>s in between

Modified: branches/Branch_5_1/src/www/include/html.php
===================================================================
--- branches/Branch_5_1/src/www/include/html.php	2011-11-16 14:39:49 UTC (rev 14806)
+++ branches/Branch_5_1/src/www/include/html.php	2011-11-16 14:39:54 UTC (rev 14807)
@@ -388,6 +388,8 @@
  * @param		array	Array of all allowed values from the full list.
  */
 function html_build_select_box_from_arrays ($vals,$texts,$select_name,$checked_val='xzxz',$show_100=true,$text_100='none',$show_any=false,$text_any='any', $allowed=false) {
+	$have_a_subelement = false;
+
 	if ($text_100=='none'){
 		$text_100=_('None');
 	}
@@ -415,11 +417,13 @@
 	if ($show_any) {
 		$return .= '
 		<option value=""'.(($checked_val=='') ? ' selected="selected"' : '').'>'. util_html_secure($text_any) .'</option>';
+		$have_a_subelement = true;
 	}
 	//we don't always want the default 100 row shown
 	if ($show_100) {
 		$return .= '
 		<option value="100"'.(($checked_val==100) ? ' selected="selected"' : '').'>'. util_html_secure($text_100) .'</option>';
+		$have_a_subelement = true;
 	}
 
 	$checked_found=false;
@@ -438,6 +442,7 @@
 				$return .= ' disabled="disabled" class="option_disabled"';
 			}
 			$return .= '>'.util_html_secure($texts[$i]).'</option>';
+			$have_a_subelement = true;
 		}
 	}
 	//
@@ -447,8 +452,14 @@
 	if (!$checked_found && $checked_val != 'xzxz' && $checked_val && $checked_val != 100) {
 		$return .= '
 		<option value="'.util_html_secure($checked_val).'" selected="selected">'._('No Change').'</option>';
+		$have_a_subelement = true;
 	}
 
+	if (!$have_a_subelement) {
+		/* <select></select> without <option/> in between is invalid */
+		return '<!-- select without options -->';
+	}
+
 	$return .= '
 		</select>';
 	return $return;




More information about the Fusionforge-commits mailing list