Trus, here is something you should be able to use.
Run this to create two tables and some sample data:
--
-- Table structure for table `jos_book_room_types`
--
CREATE TABLE `jos_book_room_types` (
`id` int(11) unsigned NOT NULL auto_increment,
`description` varchar(100) NOT NULL default '',
PRIMARY KEY (`id`),
KEY `idx_description` (`description`)
);
--
-- Dumping data for table `jos_book_room_types`
--
INSERT INTO `jos_book_room_types` VALUES (1, 'Economy');
INSERT INTO `jos_book_room_types` VALUES (2, 'Normal');
INSERT INTO `jos_book_room_types` VALUES (3, 'Suite');
INSERT INTO `jos_book_room_types` VALUES (4, 'Kitchenette');
INSERT INTO `jos_book_room_types` VALUES (5, 'Business Suite');
INSERT INTO `jos_book_room_types` VALUES (6, 'Honeymoon Suite');
INSERT INTO `jos_book_room_types` VALUES (7, 'Penthouse');
-- --------------------------------------------------------
--
-- Table structure for table `jos_book_room_category`
--
CREATE TABLE `jos_book_room_categories` (
`id` int(11) unsigned NOT NULL auto_increment,
`catid` int(11) unsigned NOT NULL default '0',
`roomid` int(11) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `idx_catid` (`catid`)
);
--
-- Dumping data for table `jos_book_room_categories`
--
INSERT INTO `jos_book_room_categories` VALUES (1, 1, 1);
INSERT INTO `jos_book_room_categories` VALUES (2, 1, 2);
INSERT INTO `jos_book_room_categories` VALUES (3, 1, 3);
INSERT INTO `jos_book_room_categories` VALUES (4, 2, 4);
INSERT INTO `jos_book_room_categories` VALUES (5, 2, 6);
INSERT INTO `jos_book_room_categories` VALUES (6, 2, 7);
INSERT INTO `jos_book_room_categories` VALUES (7, 1, 5);
-- --------------------------------------------------------
Now, in your form pieces before form, add this line above your javascript codes:
// load the standard form creation utilities
$this->execPieceByName('ff_InitLib');
Now, in the room_type select list, add this code to the options section:
<?php
$book_catid = ff_getParam('ff_param_catid', 0);
$book_catid = intval($book_catid);
$rows = ff_select(
"select jos_book_room_types.id, description ".
"from jos_book_room_types ".
"join jos_book_room_categories ".
"on jos_book_room_types.id = jos_book_room_categories.roomid ".
"where jos_book_room_categories.catid = $book_catid ".
"order by jos_book_room_types.id"
);
$flag = 0;
$list = '';
if (!is_null($rows))
foreach ($rows as $row)
$list .= "0;$row->description;$row->id\r\n";
return "1;Select Room Type;book_sel_roomid\r\n".$list;
?>
Now, by changing $book_catid between 1 and 2, you will see different values. You can do this fromm a menu or a mambot calling the form, or just edit the code.
This should help you on your way.
HTH,
Larry