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
messagehow can i use two different linked listbox group?
Posted by: nebilim (IP Logged)
Date: May 27, 2007 09:27AM

Hi, before thanks for this great scripts.
i using this: But not working top linked selectbox. working second group. In type mid name selectbox "loading" and that to stop first group. Can you help me? thnx.

$sc_ajax_select_boxes3 = new sc_ajax_select_boxes();
$sc_ajax_select_boxes3->add_select_box('kategori_tur','tid','tur','tid','','tip','sel_id_1','', 'pid=0','Seçiniz');
$sc_ajax_select_boxes3->add_select_box('kategori_tur','tid','tur','tid','','tur','sel_id_2','','','Seçiniz');
$sc_ajax_select_boxes3->link_select_boxes('tip','tur', 'pid','');
$sc_ajax_select_boxes3->place_jscripts();

$sc_ajax_select_boxes3->show_select_box('tip');
$sc_ajax_select_boxes3->show_select_box('tur');

$sc_ajax_select_boxes = new sc_ajax_select_boxes();
$sc_ajax_select_boxes->add_select_box('ililce','id','ad','id','','midi','sel_id_3','', 'parentid=0','Seçiniz');
$sc_ajax_select_boxes->add_select_box('ililce','id','ad','id','','mid','sel_id_4','','','Seçiniz');
$sc_ajax_select_boxes->link_select_boxes('midi','mid', 'parentid','');

$sc_ajax_select_boxes->show_select_box('midi');
$sc_ajax_select_boxes->show_select_box('mid');



Edited 1 time(s). Last edit at 05/27/2007 09:31AM by nebilim.

messageRe: how can i use two different linked listbox group?
Posted by: panos (IP Logged)
Date: May 27, 2007 02:23PM

Hi Nebilim,

welcome smiling smiley

in order to have more than one group you must not create a second instance of the class.
Use just the initial one.
Here is an example from one of my codes

$oSel1 = new sc_ajax_select_boxes();

// add first select box group 1
$oSel1->add_select_box('mp3dotnet_def_musical_instruments','instrument_id',
            'instrument','instrument_id','','instruments_parent_1',
            'instruments_parent_1',' style="width:200px;" ', 'parent_id=0');

// add second select box group 1    
$oSel1->add_select_box('mp3dotnet_def_musical_instruments','instrument_id',
                         'instrument','instrument_id','','instruments_child_1',
                         'instruments_child_1',' style="width:200px;" ');

// link those 2
$oSel1->link_select_boxes('instruments_parent_1','instruments_child_1', 'parent_id',-1);

// add first select box group 2    
$oSel1->add_select_box('mp3dotnet_def_musical_instruments','instrument_id',
                           'instrument','instrument_id','','instruments_parent_2',
                           'instruments_parent_2',' style="width:200px;" ', 'parent_id=0');

// add second select box group 2       
$oSel1->add_select_box('mp3dotnet_def_musical_instruments','instrument_id',
                           'instrument','instrument_id','','instruments_child_2',
                           'instruments_child_2',' style="width:200px;" ');

// link those 2

$oSel1->link_select_boxes('instruments_parent_2','instruments_child_2', 'parent_id',-1);

// add first select box group 3       
$oSel1->add_select_box('mp3dotnet_def_musical_instruments','instrument_id',
                 'instrument','instrument_id','','instruments_parent_3',
                 'instruments_parent_3',' style="width:200px;" ', 'parent_id=0');

// add second select box group 3    
$oSel1->add_select_box('mp3dotnet_def_musical_instruments','instrument_id',
                    'instrument','instrument_id','','instruments_child_3',
                    'instruments_child_3',' style="width:200px;" ');

// link those 2
$oSel1->link_select_boxes('instruments_parent_3','instruments_child_3', 'parent_id',-1);

somewhere add javascripts

<?php $oSel1->place_jscripts(); ?>


somewhere in the form place first group of select boxes

<?php $oSel1->show_select_box('instruments_parent_1'); ?>
<?php $oSel1->show_select_box('instruments_child_1'); ?>

somewhere else add second group of select boxes

<?php $oSel1->show_select_box('instruments_parent_2'); ?>
<?php $oSel1->show_select_box('instruments_child_2'); ?>

and the third group of select boxes

<?php $oSel1->show_select_box('instruments_parent_3'); ?>
<?php $oSel1->show_select_box('instruments_child_3'); ?>


and trust me it works smiling smiley

messageRe: how can i use two different linked listbox group?
Posted by: nebilim (IP Logged)
Date: May 28, 2007 05:21AM

Thanks for help. This great technic.



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