Help Dynamic Combo with javascript

0

I'm doing some tests with PHP + Oracle and I'm having a question. I made a combo, which takes data from Oracle, and controls a textfield. But now I need to update another textfield, but there is no way. Can someone help me?

asked by anonymous 11.11.2014 / 18:30

1 answer

2

An alternative is in PHP to put the name + sector in VALUE:

echo "<option value=\"".$v_nome."|" . $v_setor . "\">".$v_num."</option>";

and in Javascript,

    function alimentarCampo() {
            var codCampo = var x = document.getElementById("codCampo").selectedIndex;
            var campos = codCampo.split("|");
            document.getElementById("descrCampo").value = campos[0];
            document.getElementById("setor").value = campos[1];
    }
    
12.11.2014 / 19:42