problem getting value from select
Posted: Tue Nov 17, 2009 9:15 pm
I ahve the following code
var cellRightSel = row.insertCell(1);
var sel = document.createElement('select');
sel.id = 'filter_column_' + iteration;
sel.name = 'filter_column[]';// + iteration;
sel.options[0] = new Option('Municipio', 'Municipio');
sel.options[1] = new Option('Categoria', 'Categoria');
sel.options[2] = new Option('Zona', 'Zona');
sel.options[3] = new Option('Nivel de Ingreso', 'Nivel de Ingreso');
sel.options[4] = new Option('Vecindario', 'Vecindario');
sel.options[4] = new Option('Nivel de Transito', 'Nivel de Transito');
cellRightSel.align='center';
cellRightSel.onchange=function () {uploadValues(iteration)};
cellRightSel.appendChild(sel);
what I woul like to do is change the code to
cellRightSel.onchange=function () {uploadValues(this.value, iteration)}; //*****
Basically I want to get the value selected on cellRightSel and send it to the uploadValues function.
The problem is that I always get undefined
function uploadValues (val,num)
{
alert (val); //ALWAYSS UNDEFINED.
}
What am I doing wrong????
var cellRightSel = row.insertCell(1);
var sel = document.createElement('select');
sel.id = 'filter_column_' + iteration;
sel.name = 'filter_column[]';// + iteration;
sel.options[0] = new Option('Municipio', 'Municipio');
sel.options[1] = new Option('Categoria', 'Categoria');
sel.options[2] = new Option('Zona', 'Zona');
sel.options[3] = new Option('Nivel de Ingreso', 'Nivel de Ingreso');
sel.options[4] = new Option('Vecindario', 'Vecindario');
sel.options[4] = new Option('Nivel de Transito', 'Nivel de Transito');
cellRightSel.align='center';
cellRightSel.onchange=function () {uploadValues(iteration)};
cellRightSel.appendChild(sel);
what I woul like to do is change the code to
cellRightSel.onchange=function () {uploadValues(this.value, iteration)}; //*****
Basically I want to get the value selected on cellRightSel and send it to the uploadValues function.
The problem is that I always get undefined
function uploadValues (val,num)
{
alert (val); //ALWAYSS UNDEFINED.
}
What am I doing wrong????