0
我能够动态创建多列表框但我无法发布值。 select元素是一个二维数组,我没有从选项中返回任何值。无法发布包含多选列表框的动态行中的值
这里是我的javascript代码:
function createSelectCell(cell,column,multiselect_type_flag)
{
var copyListBox = document.getElementById(column);
var newListBox = document.createElement('select');
if(multiselect_type_flag == 'F')
{
newListBox.name = 'column_array_'+column+'[]';
}
else if(multiselect_type_flag == 'T')
{
newListBox.name = 'column_array_'+column+'[][]';
newListBox.size = '4';
newListBox.setAttribute('multiple', 'multiple');
}
for (var i = 0; i < copyListBox.options.length; i++)
{
var newOption = document.createElement("option");
newOption.text = copyListBox.options[i].text;
newOption.value = copyListBox.options[i].value;
newListBox.appendChild(newOption);
}
cell.appendChild(newListBox);
}
的意见要求对HTML:
echo "<td><select id='".$column."' name='column_array_".$column."[$i][]' multiple='multiple' size='4'>";
当我做print_r($_POST['column_array_'.$column]);
我得到:
Array ([0] => Array ([0] => Secondary Contact) [1] => Array ([0] => Authorised to log calls))
时,我应该得到:
Array ([0] => Array ([0] => Secondary Contact [1] => Authorised to log calls))
请出示列HTML标记 – Irishka
回声 “<选择的id ='” “NAME = 'column_array _” $列“$列。'。 [$ i] []'multiple ='multiple'size ='4'>“; –
如果我在帖子上做了print_r,我收到了这个结果:print_r($ _ POST ['column_array _'。$ column]); Array([0] => Array([0] => Secondary Contact)[1] => Array([0] =>授权记录调用) [0] =>辅助联系人[1] =>授权记录呼叫)) –