Hi,
I'm trying to emulate part of our client-server application as a web
site so customers can use it, and I'm stuck when it comes to
re-ordering items in a list.
Basically we have a list of available articles ("availableItems") and
a list of articles already in an issue ("selectedItems"). What I want
is to be able to move articles freely between the two lists and then
on submission add them to the issue (which I can), but also move items
in the "selectedItems" list around so that they can be re-ordered
(i.e. I want the customers to be able to change the order in which the
articles appear in the issue).
I can do both these things on screen (i.e. I have written Javascript
to move them from one box to the other (add/delete them from
"selectedItems") and to move individual articles up or down the list
of articles in the issue. Befor submitting I run a Javascript loop on
the list to select them all, from top to bottom. On screen it always
selects them in the right order (i.e. top to bottom, no matter whether
I have changed the order of these items) but when I grab the array
containing the item id numbers it's as if the change in order had
never happened!!!
Newly added or deleted papers get added/deleted fine, but when I fetch
the array from "selectedItems" I always end up with the items in the
same order, with the latest items added at the end. However, being
able to change the order of these items is crucial for this project,
but so far I have been unable to do this and I haven't found any
information on how to grab the new ORDER of items.
Here's some of the code:
I retrieve the array like this:
/*
$ia_items_new = $_POST['selectedItems'];
*/
However, this still lists the items in the OLD order:
/* if ($ia_items_old) {
foreach($ia_items_old as $key => $value) {
//echo("<BR>Old: No.".$key." - ".$value);
}
}
/*
Populating the "selectedItems" box:
/*
print( " <td><select multiple size='20' \n" );
print( " id='selectedItems' \n" );
print( " name='selectedItems[]'>\n" );
//Grab values if the information was found
$in_total_count = $objRSIssueBatord->RecordCount();
$counter = 0;
if ($in_total_count > 0) {
//Now put in an entry for every value in the batting order list:
//Get the recordset ready and extract data:
$objRSIssueBatord->MoveFirst();
while (!($objRSIssueBatord->EOF)) {
$counter ++;
//Get the variables and make string to describe items
$in_paper_id = $objRSIssueBatord->fields("bip_paper_tracker_id");
$is_jsp = $objRSIssueBatord->fields("jsp_code");
$is_customer_no = $objRSIssueBatord->fields("pap_customer_no");
if (!$is_customer_no) $is_customer_no = "N/A";
$is_author = $objRSIssueBatord->fields("pap_author");
if (!$is_author) $is_author = "N/A";
$is_batord_item = $is_jsp." - Paper No. ".$is_customer_no." -
Author: ".$is_author;
//Now list the existing items:
print( " <option value='".$in_paper_id."'>\n" );
print( " ".$is_batord_item."\n" );
print( " </option>" );
$objRSIssueBatord->MoveNext();
}
print(" </select></td>");*/
Can anyone tell me how I can grab the items in the NEW order?
Otherwise it seems a little pointless to be able to change the order
in the first place (using Javascript) if you can't actually make use
of these changes!