ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:reference:recordset:getmenu3

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
v5:reference:recordset:getmenu3 [2019/01/01 22:09] mnewnhamv5:reference:recordset:getmenu3 [2019/01/01 22:41] mnewnham
Line 5: Line 5:
 </WRAP> </WRAP>
 <WRAP right box> <WRAP right box>
 +== See Also ==
 +[[v5:reference:recordset:getmenu|getMenu()]]\\
 +[[v5:reference:recordset:getmenu2|getMenu2()]]\\
 +
 == Syntax == == Syntax ==
   string getMenu3(   string getMenu3(
Line 12: Line 16:
       optional bool $multiple=false,       optional bool $multiple=false,
       optional int $numberOfRows=0,       optional int $numberOfRows=0,
-      optional string $optionalAttributes=''+      optional string $optionalAttributes=''
-      optional bool $compareSelectedCol0=true+
       )       )
      
Line 19: Line 22:
 </WRAP> </WRAP>
 ===== Description ===== ===== Description =====
-The function ''getMenu3()'' Generates an HTML OPTGROUP select string from a recordset, and returns the string. The recordset requires 3 columns, the 3rd being used for the optgroup. The select can be defined as either a single or multiple select +The function ''getMenu3()'' Generates an HTML OPTGROUP select string from a recordset, and returns the string. The recordset requires 3 columns, the 3rd being used for the optgroup. The select can be defined as either a single or multiple select.
  
 +In order for the optgroup to work correctly, the SQL statement used must be ORDERED by some order that begins with the 3rd column in the SELECT. 
  
 ===== Parameters ===== ===== Parameters =====
Line 26: Line 30:
 name of SELECT tag name of SELECT tag
 ==== $defaultValue ==== ==== $defaultValue ====
-The value to highlight. Use an array for multiple highlight for listbox.+The value to highlight. Use either a string for a single value to match, or a numeric array if a multiselect box is going to be built and there are multiple matching defaults
 ==== $blankFirstLine ==== ==== $blankFirstLine ====
 true to leave the 1st item in list empty true to leave the 1st item in list empty
Line 35: Line 39:
 ==== $optionalAttributes ==== ==== $optionalAttributes ====
 Additional attributes to defined for SELECT tag, useful for holding javascript onChange='...' handlers or class information. Note that by default, the select box is generated without an id, so this should be included here. Additional attributes to defined for SELECT tag, useful for holding javascript onChange='...' handlers or class information. Note that by default, the select box is generated without an id, so this should be included here.
-==== $compareSelectedCol0==== 
-When we determine the selected tag, by default we compare the value provided against the first column in the recordset (the option value). By changing this to false, we compare the value against the second. 
 ===== Usage ===== ===== Usage =====
 <code php> <code php>
Line 46: Line 48:
 $result = $db->execute($SQL); $result = $db->execute($SQL);
  
-$html = $result->getMenu3('mySelect','30',true,true,10,'id="mySelect" class="myclass-1 myclass-2");+$html = $result->getMenu3('mySelect', 
 +                          array('30','40','50'), 
 +                          true, 
 +                          true, 
 +                          10, 
 +                          'id="mySelect" class="myclass-1 myclass-2");
  
 print $html print $html
Line 59: Line 66:
 <option value='20'>ESTIMATE COST</option> <option value='20'>ESTIMATE COST</option>
 <option selected='selected' value='30'>DEFINE SPECS</option> <option selected='selected' value='30'>DEFINE SPECS</option>
-<option value='40'>LEAD PROGRAM/DESIGN</option> +<option selected='selected' value='40'>LEAD PROGRAM/DESIGN</option> 
-<option value='50'>WRITE SPECS</option>+<option selected='selected' value='50'>WRITE SPECS</option>
 <option value='60'>DESCRIBE LOGIC</option> <option value='60'>DESCRIBE LOGIC</option>
 </optgroup> </optgroup>
v5/reference/recordset/getmenu3.txt · Last modified: 2019/01/01 23:50 by mnewnham