Open Source & Stuff  
  |     Main Site     |      Forum     |     Contact     |
Ajax Linked Select boxes :  forum.Salix.gr forum.Salix.gr
Comments, questions, usage, bugs. 
Goto Thread: PreviousNext
Goto: Forum ListMessage ListNew TopicSearchLog In
messageLists Showing All Items
Posted by: greenday (IP Logged)
Date: May 24, 2008 12:43AM

Hi

First of all thanks so much for this great script! Its been really useful, and i have used it 2-3 times on sites.

My problem is that I have 4 dependant menus, but they are showing all the items, until its parent is selected. Please see my problem page at:

[buyfarnorthnz.com] - scroll down, and they are used for 'Site Category'.

Here is my code:

$sc_ajax_select_boxes = new sc_ajax_select_boxes();
$sc_ajax_select_boxes->add_select_box('categories','rec_id','descr','rec_id',0,'sitecat_a1','sitecat_a1','', 'parent_id=0');
$sc_ajax_select_boxes->add_select_box('categories','rec_id','descr','rec_id',0,'sitecat_a2','sitecat_a2','','');
$sc_ajax_select_boxes->add_select_box('categories','rec_id','descr','rec_id',0,'sitecat_a3','sitecat_a3','','');
$sc_ajax_select_boxes->add_select_box('categories','rec_id','descr','rec_id',0,'sitecat_a4','sitecat_a4','','');

$sc_ajax_select_boxes->add_select_box('categories','rec_id','descr','rec_id',0,'sitecat_b1','sitecat_b1','', 'parent_id=0');
$sc_ajax_select_boxes->add_select_box('categories','rec_id','descr','rec_id',0,'sitecat_b2','sitecat_b2','','');
$sc_ajax_select_boxes->add_select_box('categories','rec_id','descr','rec_id',0,'sitecat_b3','sitecat_b3','','');
$sc_ajax_select_boxes->add_select_box('categories','rec_id','descr','rec_id',0,'sitecat_b4','sitecat_b4','','');

$sc_ajax_select_boxes->add_select_box('categories','rec_id','descr','rec_id',0,'sitecat_c1','sitecat_c1','', 'parent_id=0');
$sc_ajax_select_boxes->add_select_box('categories','rec_id','descr','rec_id',0,'sitecat_c2','sitecat_c2','','');
$sc_ajax_select_boxes->add_select_box('categories','rec_id','descr','rec_id',0,'sitecat_c3','sitecat_c3','','');
$sc_ajax_select_boxes->add_select_box('categories','rec_id','descr','rec_id',0,'sitecat_c4','sitecat_c4','','');

$sc_ajax_select_boxes->link_select_boxes('sitecat_a1','sitecat_a2', 'parent_id',0);
$sc_ajax_select_boxes->link_select_boxes('sitecat_a2','sitecat_a3', 'parent_id',0);
$sc_ajax_select_boxes->link_select_boxes('sitecat_a3','sitecat_a4', 'parent_id',0);

$sc_ajax_select_boxes->link_select_boxes('sitecat_b1','sitecat_b2', 'parent_id',0);
$sc_ajax_select_boxes->link_select_boxes('sitecat_b2','sitecat_b3', 'parent_id',0);
$sc_ajax_select_boxes->link_select_boxes('sitecat_b3','sitecat_b4', 'parent_id',0);

$sc_ajax_select_boxes->link_select_boxes('sitecat_c1','sitecat_c2', 'parent_id',0);
$sc_ajax_select_boxes->link_select_boxes('sitecat_c2','sitecat_c3', 'parent_id',0);
$sc_ajax_select_boxes->link_select_boxes('sitecat_c3','sitecat_c4', 'parent_id',0);

$sc_ajax_select_boxes->place_jscripts();

$sc_ajax_select_boxes->show_select_box('sitecat_a1');
$sc_ajax_select_boxes->show_select_box('sitecat_a2');
$sc_ajax_select_boxes->show_select_box('sitecat_a3');
$sc_ajax_select_boxes->show_select_box('sitecat_a4');echo '</td></tr> <tr><td class="KT_th">Extra Category 2</td><td>';

$sc_ajax_select_boxes->show_select_box('sitecat_b1');
$sc_ajax_select_boxes->show_select_box('sitecat_b2');
$sc_ajax_select_boxes->show_select_box('sitecat_b3');
$sc_ajax_select_boxes->show_select_box('sitecat_b4');echo '</td></tr> <tr><td class="KT_th">Extra Category 3</td><td>';

$sc_ajax_select_boxes->show_select_box('sitecat_c1');
$sc_ajax_select_boxes->show_select_box('sitecat_c2');
$sc_ajax_select_boxes->show_select_box('sitecat_c3');
$sc_ajax_select_boxes->show_select_box('sitecat_c4');echo '</td></tr>';


If any one could help i would be very gratefull. Thanks.



Edited 1 time(s). Last edit at 05/24/2008 12:45AM by greenday.

messageRe: Lists Showing All Items
Posted by: panos (IP Logged)
Date: May 27, 2008 03:01AM

Hi,

I am sorry but i cant understand the problem. Your site seems to work fine.
By the way nice site winking smiley

messageRe: Lists Showing All Items
Posted by: greenday (IP Logged)
Date: May 27, 2008 06:57PM

Hi Panos, thanks for taking the time to look at my problem, and for the compliment on the site!

If you go to [buyfarnorthnz.com] and scroll down to 'Site Category: ' you will see 4 linked select boxes. The first has 'SELECT FIRST' as the default, the other 3 underneath has '...then select' as the default. Click on one of the '...then select' lists, and you have the option of choosing all items from the database. This is the problem, you shouldn't be able to choose anything from theses three lists until the 'SELECT FIRST' has been chosen.

If you choose any option from the 'SELECT FIRST' menu, and then select again the default option as 'SELECT FIRST', the linked boxes behave as i would want them to, by not being able to select anything.

Hope that makes more sense? Any help much appreciated.



Sorry, only registered users may post in this forum.

All Rights Reserved 2006 Salix.gr  |  Design by Ades Design |  Hosting by e-emporio |  forum.Salix.gr powered by Phorum