cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carlos Chávez <ccha...@agssa.net>
Subject Re: [CForms] Edit action inside a repeater row
Date Fri, 20 May 2005 22:59:52 GMT

Sebastien Arbogast Escribio :-)
> First of all thank you very much for your answer Carlos. It's
> difficult to get answers at present time.
> I tried to integrate your suggestion in my form using a fd:submit
> widget. Here is my form definition :
>
> <fd:form id="data"
> xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
>     xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
>     <fd:widgets>
>         <fd:repeater id="users">
>             <fd:label><i18n:text key="users-list"/></fd:label>
>             <fd:widgets>
>                 <fd:output id="id">
>                     <fd:datatype base="long"/>
>                 </fd:output>
>                 <fd:output id="name">
>                     <fd:label><i18n:text key="user-name"/></fd:label>
>                     <fd:datatype base="string"/>
>                 </fd:output>
>                 <fd:submit id="edit" action-command="edit-user"
> validate="true">
>                     <fd:label>edit-user</fd:label>
>                     <fd:on-action>
>
> editUser(form.getWidget().getSubmitWidget().getParent().getId());
>                     </fd:on-action>
>                 </fd:submit>
>             </fd:widgets>
>         </fd:repeater>
>     </fd:widgets>
> </fd:form>
>
> As you can see I try to call a flowscript function with the id as a
> parameter and this flowscript function is supposed to display a form
> to edit the information of the user with the corresponding id.
> But when I click on the button nothing happens ? The current form is
> just redisplayed and a continuation is created and that's it. No
> javascript error. No exception. I really don't know what's going on.
> Do you have any idea ? Anyone ?

  Hi Sebastien.
  yes, this do not work in that way.
  you have to call the new form when the control return to
  flowscript.

  for example:

  form.load(...);
  form.showForm(...);
  form.save(...);

  // in the next line you need to obtain what widget fire the sumbit
  if (form.submitId == "edit") {
     editUser(form.getWidget().getSubmitWidget().getParent().getId());
  }
  ...
  ...

  but, the value retrieve with
form.getWidget().getSubmitWidget().getParent().getId() is the position
of the row inside the repeater (maybe in the bean is a collection). with
this value you need retrieve from the collection the real object to
edit.

  Cheers.
  Carlos Chávez.

>
> Thx in advance.
>
> --
> Sebastien ARBOGAST
>


-- 
Carlos Chávez

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message