You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by bhorvat <ho...@gmail.com> on 2012/04/11 03:51:04 UTC
Zone refresh image uplaod
Hi all,
I have already wrote about a similar thing but did get any ideas how to
solve it then (and at the point it was a minor thing I had a bigger
problem).
I have a zone and inside I have a image upload, when the zone is refreshed
an image upload throws an exception
TypeError: Cannot set property 'enctype' of undefined
[http://localhost:8080/assets/0.55-SNAPSHOT/jquery/tapestry-jquery.js:904]
Anyone has any idea how to fix this or how to handle the exception since it
is preventing javascript from working? I dont know how to catch and handle
this exception, natrualy I would prefer to fix the problem in the first
place.
So did anyone came across this? Any ideas?
cheers and thanks all
--
View this message in context: http://tapestry.1045711.n5.nabble.com/Zone-refresh-image-uplaod-tp5631622p5631622.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Zone refresh image uplaod
Posted by bhorvat <ho...@gmail.com>.
Figured it out. Thanks for help and sorry for spam :)
I will submit a JIRA tomorrow
cheers
--
View this message in context: http://tapestry.1045711.n5.nabble.com/Zone-refresh-image-uplaod-tp5631622p5634634.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Zone refresh image uplaod
Posted by bhorvat <ho...@gmail.com>.
Ok. So I have been able to figure it out (after several hours of staring in
javascript).
The tapestry sends the scirpts in the ajax response and that it loads the
old version of the file. Which is why you suggested to override Upload.java,
right?
So now I understand it all except how exactly to contribute my override
Upload to replace the current one?
One last thing, where should I submit Jira? To the tapestry or jquery team?
I recon it is the first one, right?
thanks for all the help
--
View this message in context: http://tapestry.1045711.n5.nabble.com/Zone-refresh-image-uplaod-tp5631622p5634626.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Zone refresh image uplaod
Posted by bhorvat <ho...@gmail.com>.
This is really strange.
I have spent the last hour trying to figure out how the exception is thrown
and then I found the upload.js file, the only problem is that at one point
the script run into it. But the file wasn't named upload.js. It didnt have a
name, and in chrome I can see that the "name" of the file is program.
Anyone has any idea about all of this?
If you need a better explanation please tell me.
One other thing. When this is submitted it passes an array of things that
need to be initialized all but upload is pasted as Object, but upload is
pasted as only string, and hence the error. But my question is how can I not
override this.
Any ideas?
Thanks
cheers
--
View this message in context: http://tapestry.1045711.n5.nabble.com/Zone-refresh-image-uplaod-tp5631622p5634548.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Zone refresh image uplaod
Posted by bhorvat <ho...@gmail.com>.
Yea but when I have included it like this, and do the ajax update I still get
the same error. So I am either not including it right or it is not working
as it should :S
thnx
--
View this message in context: http://tapestry.1045711.n5.nabble.com/Zone-refresh-image-uplaod-tp5631622p5634484.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Zone refresh image uplaod
Posted by Taha Hafeez Siddiqi <ta...@gmail.com>.
Hi
It is only added on ajax update.
regards
Taha
On Apr 12, 2012, at 7:12 AM, bhorvat wrote:
> Sorry to bother you with something so minor but tnx :D
>
> That file is not in my javascript files that are included so I can not be
> sure where to replace it with
>
> Tapestry.Initializer.injectedUpload = function(element)
> {
> var form = $(element).form;
>
> if(form){
> form.enctype = "multipart/form-data";
> form.encoding = "multipart/form-data";
> }
> }
>
> I have tired to add the code above to the page. I have also added something
> like this
>
> public void
> contributeMarkupRenderer(OrderedConfiguration<MarkupRendererFilter>
> configuration,
> @Path(value = "context:script/upload.js") final Asset jsa,
> final Environment environment) {
>
> configuration.add("addMissingJS", new MarkupRendererFilter() {
>
> public void renderMarkup(MarkupWriter writer, MarkupRenderer
> renderer) {
>
> JavaScriptSupport js =
> environment.peekRequired(JavaScriptSupport.class);
> js.importJavaScriptLibrary(jsa);
> renderer.renderMarkup(writer);
>
> }
> }, "after:JavaScriptSupport");
>
> }
>
> And this includes the file but it does not help. Am I overriding it wrong?
> And like I said I dont even see the fail that I am to override.
>
> cheers
>
> ps tnx for fast responses
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/Zone-refresh-image-uplaod-tp5631622p5634454.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Zone refresh image uplaod
Posted by bhorvat <ho...@gmail.com>.
Sorry to bother you with something so minor but tnx :D
That file is not in my javascript files that are included so I can not be
sure where to replace it with
Tapestry.Initializer.injectedUpload = function(element)
{
var form = $(element).form;
if(form){
form.enctype = "multipart/form-data";
form.encoding = "multipart/form-data";
}
}
I have tired to add the code above to the page. I have also added something
like this
public void
contributeMarkupRenderer(OrderedConfiguration<MarkupRendererFilter>
configuration,
@Path(value = "context:script/upload.js") final Asset jsa,
final Environment environment) {
configuration.add("addMissingJS", new MarkupRendererFilter() {
public void renderMarkup(MarkupWriter writer, MarkupRenderer
renderer) {
JavaScriptSupport js =
environment.peekRequired(JavaScriptSupport.class);
js.importJavaScriptLibrary(jsa);
renderer.renderMarkup(writer);
}
}, "after:JavaScriptSupport");
}
And this includes the file but it does not help. Am I overriding it wrong?
And like I said I dont even see the fail that I am to override.
cheers
ps tnx for fast responses
--
View this message in context: http://tapestry.1045711.n5.nabble.com/Zone-refresh-image-uplaod-tp5631622p5634454.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Zone refresh image uplaod
Posted by Taha Hafeez Siddiqi <ta...@gmail.com>.
https://github.com/apache/tapestry5/blob/trunk/tapestry-upload/src/main/resources/org/apache/tapestry5/upload/components/upload.js
On Apr 12, 2012, at 6:54 AM, bhorvat wrote:
> Hi Taha,
>
> Strangely I can not find the upload.js anywhere. Any ideas where is it?
>
> Thank you for help
>
> regards
> boris
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/Zone-refresh-image-uplaod-tp5631622p5634428.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
Re: Zone refresh image uplaod
Posted by bhorvat <ho...@gmail.com>.
Hi Taha,
Strangely I can not find the upload.js anywhere. Any ideas where is it?
Thank you for help
regards
boris
--
View this message in context: http://tapestry.1045711.n5.nabble.com/Zone-refresh-image-uplaod-tp5631622p5634428.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Zone refresh image uplaod
Posted by Taha Hafeez Siddiqi <ta...@gmail.com>.
Sorry I ended up using a non-ajax method because of other reasons.
I think it is a bug so you can file a jira. Meanwhile you can override the upload.js script by copying Upload.java from tapestry-upload along with the corresponding js and replace the contents by
Tapestry.Initializer.injectedUpload = function(element)
{
var form = $(element).form;
if(form){
form.enctype = "multipart/form-data";
form.encoding = "multipart/form-data";
}
}
regards
Taha
On Apr 12, 2012, at 6:05 AM, bhorvat wrote:
> Hi Taha,
>
> glad to see that there are others with problem :D
>
> any suggestion how to solve this. I am stuck :(
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/Zone-refresh-image-uplaod-tp5631622p5634387.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Zone refresh image uplaod
Posted by bhorvat <ho...@gmail.com>.
Hi Taha,
glad to see that there are others with problem :D
any suggestion how to solve this. I am stuck :(
--
View this message in context: http://tapestry.1045711.n5.nabble.com/Zone-refresh-image-uplaod-tp5631622p5634387.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Zone refresh image uplaod
Posted by Taha Hafeez Siddiqi <ta...@gmail.com>.
I did face this issue once. I think the issue is with upload.js in tapestry-upload.js
Tapestry.Initializer.injectedUpload = function(element)
{
var form = $(element).form;
form.enctype = "multipart/form-data";
form.encoding = "multipart/form-data";
}
$(element).form returns null for partial updates.
regards
Taha
On Apr 11, 2012, at 5:46 PM, François Facon wrote:
> Hi Boris,
>
> AjaxUpload works fine with christian sample
> https://github.com/got5/tapestry5-jquery/blob/master/src/test/resources/org/got5/tapestry5/jquery/pages/AjaxUploadTest.tml
> on jetty
>
> Could you give us more details regarding your dependencies
> - tapestry-upload,
> - commons-fileupload
> - tapestry-jquery
> are you using jetty?
>
> also extract from your .tml and .java are welcome.
>
> Regards
>
>
>
> 2012/4/11 bhorvat <ho...@gmail.com>:
>> Hi all,
>>
>> I have already wrote about a similar thing but did get any ideas how to
>> solve it then (and at the point it was a minor thing I had a bigger
>> problem).
>>
>> I have a zone and inside I have a image upload, when the zone is refreshed
>> an image upload throws an exception
>>
>> TypeError: Cannot set property 'enctype' of undefined
>> [http://localhost:8080/assets/0.55-SNAPSHOT/jquery/tapestry-jquery.js:904]
>>
>> Anyone has any idea how to fix this or how to handle the exception since it
>> is preventing javascript from working? I dont know how to catch and handle
>> this exception, natrualy I would prefer to fix the problem in the first
>> place.
>>
>> So did anyone came across this? Any ideas?
>>
>> cheers and thanks all
>>
>> --
>> View this message in context: http://tapestry.1045711.n5.nabble.com/Zone-refresh-image-uplaod-tp5631622p5631622.html
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Zone refresh image uplaod
Posted by bhorvat <ho...@gmail.com>.
Hi.
Ok so the basic scenario is like this (I have striped some code naturally)
<t:zone t:id="zone">
<t:form t:id="form">
<input t:type="upload" t:value="value" />
</t:form>
</t:zone>
so once this zone is refreshed I get the javascript exception which messes
everything on the page. For example the auto complete no longer works. If I
dont have the upload filed all is working fine. The actual Java code is also
working fine. So once the zone is refreshed I can use the from again no
problems there.
the versions that I used
tapestry-upload - 5.3.2
tapestry-jquery - 3.2.0
commons-fileupload - I didnt include this manually it is part of the
tapestry-upload and the version is 1.2
So as you can see this has nothing to do with AjaxUpload it is in fact the
upload filed inside of a zone that when it is refreshed throws an javascript
error
--
View this message in context: http://tapestry.1045711.n5.nabble.com/Zone-refresh-image-uplaod-tp5631622p5634381.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Zone refresh image uplaod
Posted by François Facon <fr...@atos.net>.
Hi Boris,
AjaxUpload works fine with christian sample
https://github.com/got5/tapestry5-jquery/blob/master/src/test/resources/org/got5/tapestry5/jquery/pages/AjaxUploadTest.tml
on jetty
Could you give us more details regarding your dependencies
- tapestry-upload,
- commons-fileupload
- tapestry-jquery
are you using jetty?
also extract from your .tml and .java are welcome.
Regards
2012/4/11 bhorvat <ho...@gmail.com>:
> Hi all,
>
> I have already wrote about a similar thing but did get any ideas how to
> solve it then (and at the point it was a minor thing I had a bigger
> problem).
>
> I have a zone and inside I have a image upload, when the zone is refreshed
> an image upload throws an exception
>
> TypeError: Cannot set property 'enctype' of undefined
> [http://localhost:8080/assets/0.55-SNAPSHOT/jquery/tapestry-jquery.js:904]
>
> Anyone has any idea how to fix this or how to handle the exception since it
> is preventing javascript from working? I dont know how to catch and handle
> this exception, natrualy I would prefer to fix the problem in the first
> place.
>
> So did anyone came across this? Any ideas?
>
> cheers and thanks all
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/Zone-refresh-image-uplaod-tp5631622p5631622.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org