急.如何从动态增加的文本框中取值??或者说如何从数据库从取值赋到动态增加的文本框中?求教
用JS动态增加的文本框代码如下:
function addLinkman(datas)
{
var link = linkman;
var tr = link.insertRow(newcount+count+2);
td0 = tr.insertCell();
td1 = tr.insertCell();
td2 = tr.insertCell();
td3 = tr.insertCell();
td4 = tr.insertCell();
td5 = tr.insertCell();
td0.innerHTML= " <input type=\ "text\ " class=\ "wbk\ " require=\ "true\ " dataType=\ "LimitB\ " min=\ "1\ " max=\ "50\ " msg=\ "姓名要在25个字内\ " value=\ " "+datas[ "conname "]+ "\ " name=\ "conname "+(newcount+count)+ "\ "/> ";
td1.innerHTML= " <input type=\ "text\ " class=\ "wbk\ " require=\ "false\ " dataType=\ "LimitB\ " min=\ "1\ " max=\ "50\ " msg=\ "部门职位要在25个字内\ " value=\ " "+datas[ "conjob "]+ "\ " name=\ "conjob "+(newcount+count)+ "\ "/> ";
td2.innerHTML= " <input type=\ "text\ " class=\ "wbk\ " require=\ "false\ " dataType=\ "Number\ " msg=\ "电话只能输入数字\ " value=\ " "+datas[ "conphone "]+ "\ " name=\ "conphone "+(newcount+count)+ "\ "/> ";
td3.innerHTML= " <input type=\ "text\ " class=\ "wbk\ " require=\ "false\ " dataType=\ "Number\ " msg=\ "手机只能输入数字\ " value=\ " "+datas[ "conmobile "]+ "\ " name=\ "conmobile "+(newcount+count)+ "\ "/> ";
td4.innerHTML= " <input type=\ "text\ " class=\ "wbk\ " require=\ "false\ " dataType=\ "Email\ " msg=\ "EMAIL格式不正确\ " value=\ " "+datas[ "conemail "]+ "\ " name=\ "conemail "+(newcount+count)+ "\ "/> ";
if (datas[ "conname "] == " ")
{
td5.innerHTML= " <input type=\ "button\ " name=\ "ch\ " class=\ "wbk\ " onClick=\ "delLinkman();\ " value=\ "删除\ "> ";
newcount++;
}
else
{
td5.innerHTML= " <input type=\ "button\ " name=\ "btn\ " class=\ "wbk\ " value=\ "删除\ " onClick=\ "goActionString( 'deleteindex ', ' "+datas[ "conId "]+ " ');\ " /> ";
count++;
}
getCount(newcount,count);
}
增加是可以增加,也可以实现增加联系人的功能了(往数据库中写入数据),现在点击编辑按钮进入页面,编辑刚刚动态添加的值.问题来了...怎么从数据库中取刚才的值放入动态文本框中.我的想法是先把数据库的值先list出来.
像这样
String sql= "SELECT * FROM PRJ_CONTACTS WHERE PRJ_CUSTOM_ID= ' "+id+ " ' ";
List list=this.getWanAn().getPageDAO().findBySQL(sql);
if(list.size()> 0){
for(int i=0;i <list.size();i++){
//colMap=(Map)list.get(i);
}
然后具体怎么把list中每列的具体内容赋给动态文本框??这个不大清楚,请教高手..拜谢了......这个急用...
[解决办法]
给动态添加的text加id属性
[解决办法]
支持楼上的
给每个text加上一个id
再赋值
[解决办法]
支持楼上的,给每个text增加一个id,然后再赋值就可以啦!
[解决办法]
${}
用这个