[Seasar-user:18028] [Teeda]xxxItemsにJavaScriptで行追加後、サブミットすると追加した行がなくなる

thomas [E-MAIL ADDRESS DELETED]
2009年 7月 20日 (月) 15:38:16 JST


Hello,


I have added some rows of items using javascript.I need to use vaildator for
the input values.

if i use the validator for any one of the variable in xxxItems,the rows that
i added using javascript will disappear.


The following is my Html file


<script>

function openmemberPopup(val){

....................
....................
addRow();
}


function addRow() {
var rowStr = '<tr class="item">';
rowStr += '<td><input type="text" id="member"></input><input type="hidden"
id="hiddenmember"></input><input type="button" value="memberselectLabel"
id="selectmember"  onclick="openmemberPopup(this)"></input></td>';
rowStr += '<td><input type="text"  id="standardunitprice"  size="8"
class="alignright"  readonly="1"></input></td>';
rowStr += '<td><input type="text"  id="applicationunitprice" size="8"
class="alignright"></input></td>';
rowStr += '<td><input type="text"  id="fixedunitprice" size="8"
class="alignright"></input></td>';
rowStr += '<td><input type="text"  id="mamhour"  size="2" class="alignright"
></input></td>';
rowStr += '<td><input type="text"  id="lowertime"  size="4"
class="alignright" ></input></td>';
rowStr += '<td><input type="text"  id="lowertimeunitprice"  size="8"
class="alignright" ></input></td>';
rowStr += '<td><input type="text"  id="uppertime"  size="4"
class="alignright" ></input></td>';
rowStr += '<td><input type="text"  id="uppertimeunitprice"  size="8"
class="alignright" ></input></td>';
rowStr += '<td><input type="hidden" id="rowno-1" /></td>';
rowStr += '</tr>';
$('#projectmemberItems').append(rowStr);
 // 明細のINDEXを振り直す
resetIndex();
}

// 明細のINDEXを振り直す
function resetIndex(){
var nameVal = 'layoutChildBody:partnermemberCreateForm:projectmemberItems:';
$('#projectmemberItems tr').each(function(idx, obj){
// 行番号を振り直す
//$(obj).find('#rowno').text('' + (idx + 1));
// name属性のindexを振りなおす
$(obj).find('#member').attr('name', nameVal + idx + ':member');
$(obj).find('#hiddenmember').attr('name', nameVal + idx + ':hiddenmember');
$(obj).find('#standardunitprice').attr('name', nameVal + idx +
':standardunitprice');
$(obj).find('#applicationunitprice').attr('name', nameVal + idx +
':applicationunitprice');
$(obj).find('#fixedunitprice').attr('name', nameVal + idx +
':fixedunitprice');
$(obj).find('#mamhour').attr('name', nameVal + idx + ':mamhour');
$(obj).find('#lowertime').attr('name', nameVal + idx + ':lowertime');
$(obj).find('#lowertimeunitprice').attr('name', nameVal + idx +
':lowertimeunitprice');
$(obj).find('#uppertime').attr('name', nameVal + idx + ':uppertime');
$(obj).find('#uppertimeunitprice').attr('name', nameVal + idx +
':uppertimeunitprice');
$(obj).find('#rowno-1').attr('name', nameVal + idx + ':rowno-1');
});
}


</script>

..............................
..............................
..............................


<tbody id="projectmemberItems">
<tr class="item">
<td><input type="text" id="member"></input><input type="hidden"
id="hiddenmember"></input>
<input type="button" value="memberselectLabel" id="selectmember"
onclick="openmemberPopup(this)"></input></td>
<td><input type="text"  id="standardunitprice"  size="8" class="alignright"
readonly="1"></input></td>
<td><input type="text"  id="applicationunitprice" size="8"
class="alignright"></input></td>
<td><input type="text"  id="fixedunitprice" size="8"
class="alignright"></input></td>
<td><input type="text"  id="mamhour" size="2"
class="alignright"></input></td>
<td><input type="text"  id="lowertime" size="4"
class="alignright"></input></td>
<td><input type="text"  id="lowertimeunitprice" size="8"
class="alignright"></input></td>
<td><input type="text"  id="uppertime" size="4"
class="alignright"></input></td>
<td><input type="text"  id="uppertimeunitprice" size="8"
class="alignright"></input></td>
</tr>
</tbody>


How can i use validator for this.


Thanks in advance,
トマス。
-------------- next part --------------
HTMLの添付ファイルを保管しました...
URL: <http://ml.seasar.org/archives/seasar-user/attachments/20090720/24c1623c/attachment.html>


Seasar-user メーリングリストの案内