Re: custom file input form element
Re: custom file input form element
- Subject: Re: custom file input form element
- From: Chuck Hill <email@hidden>
- Date: Wed, 22 Sep 2010 10:50:26 -0700
Hi Tom,
On Sep 22, 2010, at 7:20 AM, Pelaia II, Tom wrote:
>
> Thanks to all who provided feedback. I found the solution.
>
> When I override takeValuesFromRequest(), I need to call the inherited version first, then process the file uploads and then call the inherited version a second time. Maybe this isn't a bug, but rather a misunderstanding on my part. The key seems to be that WO requires the form values to be processed in the order in which they appear in the form. I assumed that I just needed to call the inherited method once and it would take care of all the WO stuff, but that is not the case.
With streaming uploads, the form values are in a stream. WO can't see the form values after the uploads until it processes the uploads. I think that is what you are seeing and why streaming uploads should go at the end of the form.
Chuck
> So the solution is to do the following in takeValuesFromRequest:
>
> super.takeValuesFromRequest(...) // process first batch of WO form elements
> process file uploads
> super.takeValuesFromRequest(...) // process remaining WO form elements
>
> thanks,
> tom
>
>
> On Sep 21, 2010, at 3:55 PM, Pelaia II, Tom wrote:
>
> Hi,
>
> I am trying to support multiple file upload by using a custom input element. It works, but for some reason it strips the form values for all form elements that follow it. So in the following example, the form values for the "testField" are stripped. If I move the test field before the file upload element, it will behave as expected and all form data gets passed correctly.
>
> Below is the code I am trying to get working:
> <wo:WOForm enctype="multipart/form-data" method="post" multipleSubmit="[true]">
> <input name="mediaupload" type="file" multiple="true" />
> <wo:WOTextField name="testField" value="[testField]" />
> <input type="submit" name="uploadData" action="[uploadData]" />
> </wo:WOForm>
>
> What is the correct way to introduce an multi-file upload element?
>
> thanks,
> tom
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden