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

thomas [E-MAIL ADDRESS DELETED]
2009年 7月 22日 (水) 15:48:08 JST


Hello,

The following is my ProjectmemberCreatePage.java and
ProjectmemberCreate.html Files

*Page Class:*

public class ProjectmemberCreatePage extends AbstractProjectmemberPage {

    public int projectmemberIndex;

    public List<MemberlistDto> projectmemberItems;

    public MemberlistDxo memberlistDxo;

    @Length(maximum=30,maximumMessageId="E15")
    public String member;

    public ProjectmemberBhv projectmemberBhv;

    public Class doSave() {

        return null;
    }

    public Class initialize() {
        return null;
    }

    public Class prerender() {
        return null;
    }

    public List<MemberlistDto> getProjectmemberItems() {
        projectmemberItems = new LinkedList();
        ProjectmemberCB memberCB = projectmemberBhv.newMyConditionBean();

        memberCB.query().setMember_Equal("XXzsxXXX");

projectmemberItems=memberlistDxo.convert(projectmemberBhv.selectList(memberCB));


        return projectmemberItems;
    }

   public void setProjectmemberItems(List<MemberlistDto> projectmemberItems)
{
    this.projectmemberItems = projectmemberItems;
    }

}


*Html:*


<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 += '</tr>';
$('#projectmemberItems').append(rowStr);


resetIndex();

}


function resetIndex(){

var nameVal = 'layoutChildBody:projectmberCreateForm:projectmemberItems:';
$('#projectmemberItems tr').each(function(idx, obj){

$(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');

});
}


</script>


<form id="projectmberCreateForm">

<input type="hidden" id="projectmemberItemsSave"/>
<table>
<tr align="center" class="mainheading">
<td><label id="yearmonths"/></td>
<td colspan="8"><span id="yearmonth1"></span></td>
</tr>
<tr class="heading" align="center">
<td rowspan="2"><label id="projectmember"/></td>
<td rowspan="2"><label id="standardunitprice"/></td>
<td rowspan="2"><label id="applicationunitprice"/></td>
<td rowspan="2"><label id="fixedunitprice"/></td>
<td rowspan="2"><label id="manhour"/></td>
<td colspan="2"><label id="lower"/></td>
<td colspan="2"><label id="upper"/></td>
</tr>
<tr  class="heading" align="center">
<td><label id="lowertime"/></td>
<td><label id="lowertimeunitprice"/></td>
<td><label id="uppertime"/></td>
<td><label id="uppertimeunitprice"/></td>
</tr>
<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>
</table>


</form>



Thanks,
トマス










2009/7/22 Koichi Kobayashi <[E-MAIL ADDRESS DELETED]>

> 小林 (koichik) です.
>
> Is type of the projectmemberItems an array or a generic List?
>
> public ProjectMemberDto[] projectmemberItems; //right
> public List<ProjectMemberDto> projectmemberItems; //right
> public List projectmemberItems; //wrong
>
> Can you show the *minimum* Page class and HTML
> that I can confirm with the Teeda HTML Example?
>
> Date:    Tue, 21 Jul 2009 19:39:53 +0900
> From:    thomas <[E-MAIL ADDRESS DELETED]>
> To:      [E-MAIL ADDRESS DELETED]
> Subject: [Seasar-user:18035] Re:
> [Teeda]xxxItemsにJavaScriptで行追加後、サブミットすると追加した行がなくなる
>
> > >Before adding rows, how many rows were there in a <table>?
> >
> >
> > There* is only one row* before adding Rows....
> >
> >
> >
> > 2009/7/21 Koichi Kobayashi <[E-MAIL ADDRESS DELETED]>
> >
> > > 小林 (koichik) です.
> > >
> > > Date:    Tue, 21 Jul 2009 18:37:47 +0900
> > > From:    thomas <[E-MAIL ADDRESS DELETED]>
> > > To:      [E-MAIL ADDRESS DELETED]
> > > Subject: [Seasar-user:18033] Re:
> > > [Teeda]xxxItemsにJavaScriptで行追加後、サブミットすると追加した行がなくなる
> > >
> > > > The following is the log of requestDumpFilter.
> > >
> > > Before adding rows, how many rows were there in a <table>?
> > >
> > >
> > > --
> > > <component name="koichik">
> > >    <property name="fullName">"Koichi Kobayashi"</property>
> > >    <property name="email">"[E-MAIL ADDRESS DELETED]"</property>
> > >    <property name="blog">"http://d.hatena.ne.jp/koichik"</property>
> > > </component>
> > >
> > > _______________________________________________
> > > Seasar-user mailing list
> > > [E-MAIL ADDRESS DELETED]
> > > https://ml.seasar.org/mailman/listinfo/seasar-user
> > >
>
> --
> <component name="koichik">
>    <property name="fullName">"Koichi Kobayashi"</property>
>    <property name="email">"[E-MAIL ADDRESS DELETED]"</property>
>    <property name="blog">"http://d.hatena.ne.jp/koichik"</property>
> </component>
>
> _______________________________________________
> Seasar-user mailing list
> [E-MAIL ADDRESS DELETED]
> https://ml.seasar.org/mailman/listinfo/seasar-user
>
-------------- next part --------------
HTMLの添付ファイルを保管しました...
URL: <http://ml.seasar.org/archives/seasar-user/attachments/20090722/30d18a19/attachment.html>


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