Input généré en javascript
Bonjour,
Je génère des input text en javascript par deçu des combobox afin de faire des combobox éditable.
Le champ que je souhaite récupérer n'est pas la combobox mais l'input text car lui évolue quand on change la combobox.
Cependant dans $_POST je ne récupère que les valeurs des combobox.
Est-ce dû au faite que je les génère en javascript? Il y a-t-il des subtilités qui m'échappe?
Je mets un bout de code au cas où mais je sais pas trop quoi mettre sachant que tout fonctionne dans la génération et le placement:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
| function inittextfield(ctrl) {
selectWidth = ctrl.offsetWidth;
//Create textfield
textfield = document.createElement("input");
textfield.id = "txtreal" + ctrl.name;
textfield.name = ctrl.name;
ctrl.name = "real" + textfield.name;
textfield.className = "comboText";
textfield.style.zIndex = "99999";
var attrType = document.createAttribute("type");
attrType.nodeValue = "text"
textfield.setAttributeNode(attrType);
alert("test");
textfield.value = ctrl.options[ctrl.selectedIndex].text;
textfield.style.position = "absolute";
//textfield.style.top = nTop + "px";
textfield.style.left = nLeft + "px";
textfield.style.border = "none";
//Account for Browser Interface Differences Here
if((detect.indexOf("safari") + 1)) {
selectButtonWidth = 18
textfield.style.marginTop = "0px";
textfield.style.marginLeft = "0px";
}
else if((detect.indexOf("opera") + 1)) {
selectButtonWidth = 27;
textfield.style.marginTop = "4px";
textfield.style.marginLeft = "4px";
}
else if((detect.indexOf("mozilla") + 1)) {
selectButtonWidth = 20;
textfield.style.marginTop = "1px";
textfield.style.marginLeft = "1px";
}
else {
selectButtonWidth = 27;
textfield.style.marginTop = "2px";
textfield.style.marginLeft = "3px";
}
textfield.style.width = (selectWidth - selectButtonWidth) + "px";
ctrl.parentNode.appendChild(textfield);
ctrl.onchange=function() {
val = this.options[this.selectedIndex].value;
document.getElementById("txt" + this.name).value = val;
}
} |
Merci d'avance,
Gripsou