dimanche 19 avril 2015

Pass all option values in form

Within a form, I have a select element with id=keywords. This element has size="6", but no option elements in the HTML file. A JavaScript function that executes when the page loads populates the list as follows:



function setKeywords() {
for (i = 0; i <= 5; i = i + 1) {
var option;
option = document.createElement("option");
option.name = "keyword" + (i + 1).toString();
option.value = "null";
option.text = "";
document.getElementById("keywords").add(option);
}
}


Users then can add and remove up to six values to the list via other JavaScript functions (the code of which isn't useful for the purpose of this question), and then I wish to pass the values of these six option elements (among other inputted values in the form) to another page via POST. I thought that since I named these elements keyword1, keyword2, etc., that these values would then pass with the rest of the form. The other inputted values in the form are being passed successfully, but that's not happening with these keywords.


What must I change in order to pass the values of these option elements with the rest of the form?


Aucun commentaire:

Enregistrer un commentaire