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

2004-08-04 Thread Stephane Delort


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 [EMAIL PROTECTED]

Gesendet von:  news [EMAIL PROTECTED]


An:   [EMAIL PROTECTED]
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





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



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

2004-08-04 Thread oceatoon
Thank you Stephane, your 2 cents did the trick, all this noise for this, I'd
better go find a hole and dig myself in.I was just missing the
enctype=multipart/form-data. 
Tibor
 

Stephane Delort wrote:

 
 
 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 [EMAIL PROTECTED]
 
 Gesendet von:  news [EMAIL PROTECTED]
 
 
 An:   [EMAIL PROTECTED]
 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: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



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