Hi again,

I am still working on the same form!
I have managed to get my javascript initialized and uploaded to the client!
Everything works great until I get in the onActivate method.

Then I get an exception, which I can't figure out the problem, I have also
explicit changed the Form.method to Post!

TapestryModule.RequestExceptionHandler Processing of request failed with
uncaught exception: Forms require that the request method be POST and that
the t:formdata query parameter have values.

org.apache.tapestry5.ioc.internal.OperationException: Forms require that the
request method be POST and that the t:formdata query parameter have values.
[at classpath:nl/test/web/pages/personal/AddProduct.tml, line 6]



THIS IS MY PAGE WITH FORM
#################################

<html t:type="layout"

title="${message:title}"

      xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd";

      xmlns:p="tapestry:parameter">

    <p>Post a new product:</p>

     <t:form t:id="upload" >

        <t:errors/>

        <t:beaneditor t:id="product" object="product" />

        <br/><br/>

        <input type="file" id="ga" name="file"/>


        <br/><br/>

        <input t:type="submit" t:id="button" t:value="message:button-label"
/>



    </t:form>

</html>



THIS IS MY JAVA PAGE
#################################

@Import(library = { "context:javascript/swfupload.js",
"context:javascript/test.js", "context:javascript/addproduct.js" })

@PluginPageMenu(className = Personal.class, label = "Post a new product")

public class AddProduct {



 @Inject

private Logger logger;

 @Property

private Product product;

 @Component(id = "upload")

private Form _form;

  /* UPLOAD SERVICE*/

@Inject

private MyFileUploadService uploadService;

/*    ** START JAVASCRIPT  ** */

@Inject

private JavaScriptSupport javaScriptSupport;

/* END JAVASCRIPT */





public void afterRender(final MarkupWriter writer) {

 javaScriptSupport.addInitializerCall("upload","");

  }


 public void onSuccess() {

 logger.debug("############# SUCCES ##########");

}


 public void onActivate() {


 logger.debug("############# On Activate  ##########");

}




}



This is my javascript

   Tapestry.Initializer.upload = function(element)

{

document.forms['upload'].enctype = "multipart/form-data";

document.forms['upload'].method = "POST";

}



I hope someone can help me with this error!

Cheers,

Fernando


On 31 March 2011 00:15, Fernando Benjamin <fernandobenja...@gmail.com>wrote:

> Haaa, I overlooked the other option, I'll try with javascript!
>
> Thank you!
>
>
> On 31 March 2011 00:14, Fernando Benjamin <fernandobenja...@gmail.com>wrote:
>
>> Hi Howard,
>>
>> The Upload component requires a UploadFile as a value!
>> I want to use here a plain html input file and not one of tapestry
>> components!
>> If I replace
>> <input type="file" id="ga" name="file"/>
>> WITH
>>
>> <input t:type="upload" t:id="file" />
>> It does change the contenttype of the form as I wanted, but this means I
>> have to use UploadedFile, because its value is required in Upload?
>>
>> I would like to use tapestry's form and just change the contenttype!
>>
>>
>>
>>
>>
>>
>>
>>
>> On 30 March 2011 00:04, Howard Lewis Ship <hls...@gmail.com> wrote:
>>
>>> Look at the Upload component source; you'll see how it does it.
>>>
>>> On Tue, Mar 29, 2011 at 2:07 PM, Fernando Benjamin
>>> <fernandobenja...@gmail.com> wrote:
>>> > Hi everybody,
>>> >
>>> >
>>> > I am trying to upload a file to GAE by using a tapestry form, but I
>>> can't
>>> > use tapestry 5 Upload component because it depends on a class writing
>>> to the
>>> > filesystem!
>>> > I need to set the contenttype of the form to "multipart/form-data" so I
>>> can
>>> > retrieve the file on the servlet(filter).
>>> >
>>> > This is my example which does not work!
>>> >
>>> >  <t:form   t:id="upload" t:contenttype="multipart/form-data" >
>>> >
>>> >        <t:errors/>
>>> >
>>> >        <t:beaneditor t:id="product" object="product" />
>>> >
>>> >        <br/><br/>
>>> >
>>> >        <input type="file" id="ga" name="file"/>
>>> >
>>> >
>>> >        <br/><br/>
>>> >
>>> >        <input t:type="submit" t:id="button"
>>> t:value="message:button-label"
>>> > />
>>> >
>>> >
>>> >
>>> >    </t:form>
>>> >
>>> >
>>> > Is there any other form to change the content type of the  form here
>>> above?
>>> >
>>> > Otherwise I'll have to use normal html form wich does not support:
>>> errors,
>>> > beaneditor en etc...
>>> >
>>> >
>>> > Cheers,
>>> >
>>> > Fernando
>>> >
>>>
>>>
>>>
>>> --
>>> Howard M. Lewis Ship
>>>
>>> Creator of Apache Tapestry
>>>
>>> The source for Tapestry training, mentoring and support. Contact me to
>>> learn how I can get you up and productive in Tapestry fast!
>>>
>>> (971) 678-5210
>>> http://howardlewisship.com
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>>
>>>
>>
>

Reply via email to