Yep, i also saw the single 'add' behaviour.
Your exact code results in the following issues:
- when add is pressed once, submit behaves like add
- when add is pressed more than once, submit triggers the 
delete button.

I've already added your files to reproduce this, but SF wouldn't 
let me commit earlier on.

I would advice you to also log an issue at
http://tacoscomponents.jot.com/BugReporter
and then revert to using updateComponents="ognl:{'part1'}"
until we fix it.

>From Mike Oestereter <[EMAIL PROTECTED]>:

> On 7/13/06, Andreas Andreou <[EMAIL PROTECTED]> wrote:
> > - if you change everything to update part1, it works normally...
> > Why do you say 'without the partial updates' ?
> 
> You're right - I mean of course "without the partial updates" of only
> the recurring items.
> 
> > - if you leave it as is, the problem is that the doRemoveItem listener is
> > somehow triggered when you click on the submit button. This results
> > in an item removed and the iteration failing with the error message you
> > described. I don't yet know why this is happening... :(
> 
> I presume you are talking about clicking the "add" button more than
> once. While adding the submission of values seems to me fine. Its only
> on the final "submit" button that things go wrong.
> 
> For what it is worth.. I had a similar problem also for a while after
> a "submit" (I think with the normal @Form) that a component with id
> "tx" was expected in stead of the "submit" (or otherway around) no
> matter if I was adding or removing.
> 
> Not sure if it helps.. After a single "add" it behaves like the "add"
> action is being stored and repeated during the "submit"?
> 
> Any case  -  if there is anything I can do besides testing please shout.
> 
> >
> > Mike Oestereter wrote:
> > > Hello
> > >
> > > My code below works for the item delete - but a normal "submit" button
> > > click after an "add" button click gives me an unexpected and
> > > additional "add".
> > > Also, if I do more than one "add" followed my a final "submit" the
> > > whole thing goes out of sync with a..
> > > Caused by: ognl.MethodFailedException: Method "setMyItemValue" failed
> > > for object [EMAIL PROTECTED]
> > > [java.lang.IndexOutOfBoundsException: Index: 4, Size: 4]
> > >
> > > It works fine if I take out  the Tacos/Ajax components - but then of
> > > course also without the nice partial screen updates.
> > >
> > > If I use a @tacos:PartialFor instead of the normal @For then the whole
> > > thing also goes out of sync.
> > > A normal @Form also does not work.
> > > To move the invocation form the "listener" to the "action" has not any
> > > influence.
> > > If I change the updateComponents of the add button to part1 [it
> > > includes the form] in stead of part2 [does not include the form
> > > component]  (this is not what I want) then the submission works - but
> > > without the partial updates as I wanted and I might as well use normal
> > > non-Ajaxy stuff.
> > >
> > > I'm using the tacos4-beta-3-20060710-1929. I want to use the MenuBar2
> > > stuff.
> > >
> > > Thanks in advance
> > >
> > >
> > >
> > > This is my html
> > >
> > >        <span jwcid="@Insert"
> > >              value="ognl:new java.util.Date()"/>
> > >        <div jwcid="[EMAIL PROTECTED]"
> > >                 id="part1">
> > >        <form jwcid="[EMAIL PROTECTED]:AjaxForm">
> > >            <input jwcid="[EMAIL PROTECTED]"
> > >                   value="ognl:otherValue1"/><br/>
> > >            <span jwcid="@Insert"
> > >                  value="ognl:new java.util.Date()"/><br/>
> > >            <input jwcid="[EMAIL PROTECTED]"
> > >                   value="ognl:otherValue2"/>
> > >            <div jwcid="[EMAIL PROTECTED]"
> > >                 id="part2">
> > >                <table>
> > >                    <tr jwcid="@For"
> > >                        element="tr"
> > >                        source="ognl:mylist"
> > >                        index="ognl:index">
> > >                        <td>
> > >                            <span jwcid="@Insert"
> > >                                  value="ognl:index"/>
> > >                        </td>
> > >                        <td>
> > >                            <input jwcid="[EMAIL PROTECTED]"
> > >                                   value="ognl:myItemValue"/>
> > >                        </td>
> > >                        <td>
> > >                            <input jwcid="[EMAIL PROTECTED]:AjaxSubmit"
> > >                                   action="listener:doRemoveItem"
> > >                                   parameters="ognl:index"
> > >                                   value="Delete"
> > >                                   updateComponents="ognl:{'part2'}"/>
> > >                        </td>
> > >                    </tr>
> > >                </table>
> > >            </div>
> > >            <input jwcid="[EMAIL PROTECTED]:AjaxSubmit"
> > >                   action="listener:doAddItem"
> > >                   updateComponents="ognl:{'part2'}"
> > >                   value="Add"/>
> > >
> > >            <input jwcid="[EMAIL PROTECTED]:AjaxSubmit"
> > >                   listener="listener:doSubmit1"
> > >                   updateComponents="ognl:{'part1'}"
> > >                   value="Submit"/>
> > >        </form>
> > >        </div>
> > >
> > > My .page
> > >
> > >    <property name="otherValue1" persist="session" />
> > >    <property name="otherValue2" persist="session" />
> > >    <property name="index" initial-value="0" />
> > >    <property name="mylist" persist="session" />
> > >
> > > And the .java
> > >
> > >    public abstract void setOtherValue1(String value);
> > >    public abstract String getOtherValue1();
> > >
> > >    public abstract void setOtherValue2(String value);
> > >    public abstract String getOtherValue2();
> > >
> > >    public abstract List getMylist();
> > >    public abstract void setMylist(List list);
> > >
> > >    public abstract int getIndex();
> > >
> > >    public void pageBeginRender(PageEvent pageEvent) {
> > >        if (getMylist() == null) {
> > >            ArrayList list = new ArrayList();
> > >            list.add("one");
> > >            list.add("two");
> > >            list.add("three");
> > >            setMylist(list);
> > >        }
> > >    }
> > >
> > >    public void doSubmit1(IRequestCycle cycle) {
> > >    }
> > >
> > >    public void doRemoveItem(IRequestCycle cycle, int idx) {
> > >            getMylist().remove(idx);
> > >    }
> > >
> > >    public void doAddItem(IRequestCycle cycle) {
> > >        getMylist().add(new String("new stringy"));
> > >    }
> > >
> > >    public String getMyItemValue() {
> > >        return (String) getMylist().get(getIndex());
> > >    }
> > >
> > >    public void setMyItemValue(String value) {
> > >        getMylist().set(getIndex(),value);
> > >    }
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to