Hello Lindsey,

Perhaps the hidden field is not inside the form, or inside the same form as is the WOFileUpload?

Regards,
Mark

On May 24, 2006, at 2:35 PM, Lindsey Hotchkies wrote:

Thanks for your help!
I tried setting a hidden field in the form, but in the
direct action, request().formValues() only returns the
file from the WOFileUpload component, nothing else.

I am confused because I have used Direct Actions for
non-fileUpload actions, and parameters (whether they
are within a form or set in a hyperlink binding) are
passed in the request. Now that I am using a
WOFileUpload object inside a form, the other form
components and bindings seem to be ignored.

Here are my components (notice I tried to pass a
parameter in the form as well as the HiddenField):

Form2: WOForm {
    enctype = "multipart/form-data";
        multipleSubmit = true;
        ?mainphotoid = mainPhotoId;
        directActionName = "ProcessTwinFileUploadAsData";
        actionClass = "DirectAction";
}

Upload1 : WOFileUpload {
    filePath = aFileName;
    data = aFileContents;
        mimeType = uploadMimeType;
        name = "thefile";
}

mainphotoid: WOHiddenField {
        name = "mainphotoid";
        value = mainPhotoId;
}

This is the result of request().formValues() in
ProcessTwinFileUploadAsDataAction:
{thefile.filename = ("bunny-3c.jpg"); thefile =
(<class
com.webobjects.appserver._private.WOInputStreamData
(stream
com.webobjects.appserver.WOMultipartIterator [EMAIL PROTECTED]
of length 0), has NOT been accessed>);
thefile.mimetype = ("image/jpeg"); }

The file upload is successful, but no parameter.
Any ideas?

Thanks!
-Lindsey

--- Amedeo Mantica <[EMAIL PROTECTED]> wrote:

You can pass parameter to the direct action

look at this code in direct action:


     public WOActionResults myPersonalAction()
{                               //ending with
"Action" in mendatory
                String theVariable =
(String)request().formValueForKey("myvariable");

                YourWOComponent nextPage =
(YourWOComponent)pageWithName
("YourWOComponent");  //replace "YourWOComponent"
with    the     name    of      
your    component
                nextPage.setTheVariable(theVariable);
         return nextPage;
     }

and you can acccess to the page using this url

http://.../myapp.woa/wa/myPersonal?myvariable=try
   //note
myPersonal without "Action"

Best Regards
Amedeo


On 24/mag/06, at 08:53, Lindsey Hotchkies wrote:

Newbie file upload question:

I am trying to upload a file using a direct action
and
a WOFileUpload component. I can get the file to
upload
correctly, but my issue is with sending a
parameter to
the direct action so that it can properly set up
the
next page and save the file into the database with
the
right info.
The values I need for the file in the database are
determined by the page from which the user
triggers
the upload. So, to use direct actions I think I
need
to send those values as parameters (bindings to
the
WOFileUpload or Form) with the upload. I tried
binding
them to the WOFileUpload and/or the Form with no
success (the values don't appear in
request().formValues() in the DA).

Is there any way to send parameters (custom
bindings)
with a Direct Action file upload?

Thanks!!
-Lindsey
 _______________________________________________
Do not post admin requests to the list. They will
be ignored.
Webobjects-dev mailing list
([email protected])
Help/Unsubscribe/Update your Subscription:


http://lists.apple.com/mailman/options/webobjects-dev/amedeo%

40macintossicati.com

This email sent to [EMAIL PROTECTED]



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/markm% 40onpointsoftware.com

This email sent to [EMAIL PROTECTED]

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to