cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephane Delort" <Stephane.Del...@edag.de>
Subject Antwort: Re: Flow : Accessing Repeater Rows value in Flow
Date Wed, 04 Aug 2004 06:56:26 GMT


Hi Tibor;

I have a repeater with a fileUpload widget and I guess you can try this :

/**
* display the form
*/
var form = new Form("forms/atom_form.xml" );
form.showForm("atom_form-display-pipeline", data);

/**
* get the widget back from the form
*/
cocoon.request.setAttribute("RUDefinitionForm2", form.getWidget());
var reqAttf2 = cocoon.request.getAttribute("RUDefinitionForm2");

/ get the repeater widget
 var RUTargetUpload = reqAttf2.lookupWidget("target-upl");

/**
*  Here I test if the field is not empty, and, in case not, I put the file in my DB
*/
for(var i=0; i< RUTargetUpload.getSize(); i++)   {
  if( RUTargetUpload.getWidget(i, "target-upload").getValue() ) {
     ru.newTargetFile(  RUTargetUpload.getWidget(i, "target-upload").getValue() );   // put
the file in a Java class which inter it in a database
  }
}


By the way, the reason why you loose the filled fields when you add or
remove a row in the repeater could be that you forget to add enctype
="multipart/form-data"  in the ft:form-template  element, inside the
template file.

RTFM : http://cocoon.apache.org/2.1/userdocs/forms/widget_upload.html
(line 3)



my 2 cents,
Stephane





Bitte antworten an users@cocoon.apache.org

Gesendet von:  news <news@sea.gmane.org>


An:   users@cocoon.apache.org
Kopie:

Thema:    Re: Flow : Accessing Repeater Rows value in Flow


Hi Joerg

I still get a result null
form.getWidget().houseuploads.getRow(0).getChild("path").value
=> returns null ("path" being my upload widget)
and the field widget in the same repeater returns its content ???

Another funny reaction is when I add an element to the repeater,all the
previously existent rows erase their upload widgets content and have to be
newly filled ???

The other problem I have, is the form.getWidget().houseuploads.size just
like in the form1 sample doesn't seem to work either ???

hope this sheds some light
thanks for the help.
Tibor


Joerg Heinicke wrote:

> On 03.08.2004 21:41, oceatoon wrote:
>
>> form.getWidget().repeaterName.getRow(0).widgetName.value (for row 0)
>
> Can you try
> form.getWidget().repeaterName.getRow(0).getChild("widgetName").value
> instead? The upload widget itself should not behave different than a
> field widget, but maybe the JS wrapper is broken for it.
>
> Joerg



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





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


Mime
View raw message