Smintheu
03-29-2006, 06:12 AM
Hello,
I'm trying to create a select box based on what a user selects in another select box. This seems to work fine in IE and FF, but if I submit the form, the data from the dynamically created box don't seem to get posted.
code to create the box:
if (booksArray.length > 0) {
/* Create a select box with one empty value */
var selectbox = document.createElement("select");
selectbox.setAttribute("name", "book_selector");
selectbox.setAttribute("id", "bookselector");
var empty = document.createElement("option");
var emptyTxt = document.createTextNode("");
empty.setAttribute("value", "empty");
empty.appendChild(emptyTxt);
selectbox.appendChild(empty);
var responseDiv = document.getElementById('select_photobook');
responseDiv.appendChild(explanation);
responseDiv.appendChild(selectbox);
for (i=0; i<booksArray.length; i++) {
bookElement = booksArray[i].childNodes[0].nodeValue;
bookElementID = booksArray[i].getAttribute("photobookid");
outPutter(bookElementID, bookElement);
} //end for
} //end if
/* outputter function populates the select box */
function outPutter(ID, contents) {
var output = document.createElement("option");
output.setAttribute("value", ID);
var outputTxt = document.createTextNode(contents);
output.appendChild(outputTxt);
var responseDiv = document.getElementById("bookselector");
responseDiv.appendChild(output);
} //end function
This works just fine, but if I submit the form in FF and do a print_r($_REQUEST) (php code to print the array of all the arguments), I don't get the data from the second select box.
The result of the print_r($_REQUEST) in IE:
Array ( [pageid] => photobook [selected_fb] => save [fb_location] => 4 [book_selector] => 3 [BSUID] => 1 [FRQSTR] => 19027377x246536:1:10080|19027377|19027377|19027377|19027377 [WIDYMD] => #36659:FCF# [KIDYMD] => #246536:FCFA#243265:FBPA# [PHPSESSID] => 4bd690f29bc88341e46708c0c9dfe0a5 )
and in FF:
Array ( [pageid] => photobook [selected_fb] => save [fb_location] => 4 [PHPSESSID] => 59c30c705172988ab7ce64b38c3214e4 )
So the book_selector argument is not passed on.
Anybody got an idea?
Very much appreciated,
Daan
I'm trying to create a select box based on what a user selects in another select box. This seems to work fine in IE and FF, but if I submit the form, the data from the dynamically created box don't seem to get posted.
code to create the box:
if (booksArray.length > 0) {
/* Create a select box with one empty value */
var selectbox = document.createElement("select");
selectbox.setAttribute("name", "book_selector");
selectbox.setAttribute("id", "bookselector");
var empty = document.createElement("option");
var emptyTxt = document.createTextNode("");
empty.setAttribute("value", "empty");
empty.appendChild(emptyTxt);
selectbox.appendChild(empty);
var responseDiv = document.getElementById('select_photobook');
responseDiv.appendChild(explanation);
responseDiv.appendChild(selectbox);
for (i=0; i<booksArray.length; i++) {
bookElement = booksArray[i].childNodes[0].nodeValue;
bookElementID = booksArray[i].getAttribute("photobookid");
outPutter(bookElementID, bookElement);
} //end for
} //end if
/* outputter function populates the select box */
function outPutter(ID, contents) {
var output = document.createElement("option");
output.setAttribute("value", ID);
var outputTxt = document.createTextNode(contents);
output.appendChild(outputTxt);
var responseDiv = document.getElementById("bookselector");
responseDiv.appendChild(output);
} //end function
This works just fine, but if I submit the form in FF and do a print_r($_REQUEST) (php code to print the array of all the arguments), I don't get the data from the second select box.
The result of the print_r($_REQUEST) in IE:
Array ( [pageid] => photobook [selected_fb] => save [fb_location] => 4 [book_selector] => 3 [BSUID] => 1 [FRQSTR] => 19027377x246536:1:10080|19027377|19027377|19027377|19027377 [WIDYMD] => #36659:FCF# [KIDYMD] => #246536:FCFA#243265:FBPA# [PHPSESSID] => 4bd690f29bc88341e46708c0c9dfe0a5 )
and in FF:
Array ( [pageid] => photobook [selected_fb] => save [fb_location] => 4 [PHPSESSID] => 59c30c705172988ab7ce64b38c3214e4 )
So the book_selector argument is not passed on.
Anybody got an idea?
Very much appreciated,
Daan