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]

Reply via email to