DvdW
Posts: 10
|
Posted: 01/23/2012, 5:31 AM |
|
Hi,
I've 2 dependent listboxes (master and slave). The ajax feature works fine on insert but how can I set the selected value on update for the slave listbox.
Exemple :
Listbox 1 :
Document (SELECTED)
Papers
Listbox 2 :
Notes
Summary (SELECTED)
After insert, the two values are well inserted in the table; on update the 2 listboxes are well filled but only the first as the document value selected. The second lisbbox contain the good values (Notes and summary) but Summary is not selected.
Thank you in advance
Dominique
|
|
|
drLeo
Posts: 12
|
Posted: 01/25/2012, 3:36 PM |
|
If you don't want headaches do it with jQuery and jSON. It's painless and more fun.
1. Build jSON in CCS because is very easy.
2. feed select box from jSON with jQuey (no conflict with prototype, if you don't use window.load event). If you want a very easy way, use jCombo library, a little bit slower, no callback function, but super easy.
I just finish a big project, and I have some problems with auto-generated select boxes and other Ajax/JavaScript stuff from CCS.
Regards.
|
|
|
andrea
Posts: 18
|
Posted: 03/30/2012, 3:02 AM |
|
I had the same problem. Here is how I resolved it.
I have a simple upload documents page. The structure of the table for the documents is:
id_doc
description
id_category
filename
The category is a simple two levels tree
id_category
id_parent
description
Each document has a category and a subcategory. Only the subcategory is needed since the parent can be easily retreived.
On the form I have a MasterCat ListBox for the category and a Slave ListBox for the subcategory. I run the Dependent ListBoxes to link the two ListBoxes, then in the MasterCat ListBox Before Show event I placed
if ($documents->EditMode) {
$db = new clsDBConnection1();
$id_category = $documents->Slave->GetValue();
$documents->MasterCat->SetValue(CCDLookUp("id_parent","categories_doc","id_category=".$id_category,$db));
$db->close();
}
Remember to fill the Connection, Data Source, Bound Column and Text Column not only for the Master, but also for the slave.
Hope it helps.
Andrea
|
|
|
|