QuickForm: design question regarding 3 level hierselect - how to add an "id=" option to each selection menu option

From: Date: Mon, 01 Aug 2005 13:14:03 +0000
Subject: QuickForm: design question regarding 3 level hierselect - how to add an "id=" option to each selection menu option
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-20215@lists.php.net to get a copy of this message
The code below shows what I am trying to do. It works fine. I have a javascript link that takes the value of the last selection menu, $policy, and opens the details of the policy in a new window. The problem is that the index of the policy starts at an index of zero for all selection menus which does not reflect the record ID of the record. I could choose to lookup the record by title but the javascript in one line is almost impossible to I am looking for a way to add an "id=" option to each selection menu option which would have the record ID so lookups would be much easier. Any ideas are much appreciated! $article = $db->getAssoc("SELECT article_ID, desc FROM table1"); $result = $db->query("SELECT article_ID, section_ID, section_title FROM section_table"); while ($result->fetchInto($row)) { $sect[$row[0]][$row[1]] = $row[2]; } $policy_result = $db->query("SELECT s.article_ID, p.section_ID, p.policy_ID, p.policyTitle FROM policy p INNER JOIN section_table s ON p.section_ID = s.section_ID"); while ($rules_result->fetchInto($row1)) { $policy[$row1[0]][$row1[1]][$row1[2]] = $row1[3]; } $sel =& $form->addElement('hierselect', 'rule', 'Rule Selection:', array('style' => 'width: 30em;'), '<br />'); $sel->setOptions(array($article, $sect, $policy)); ____________________________________________________ Start your day with Yahoo! - make it your home page http://www.yahoo.com/r/hs

« previous php.pear.general (#20215) next »