PDA

View Full Version : Image problem in ext js



hadi78
12 Nov 2009, 6:50 AM
Hi,

I have the following issue:

i have a form. Whenever the submit button is pressed some data is send to the server. The server uses this data to create an image and sends it back to the client...but here i get a strange "illegal (png)" error in firebug. this is maybe because the success method of submit is waiting for a json file instead of an image? So my question is now, how i can process an image in Ext JS after submitting a form and getting an image back from the server? Is there any nice solution?

12 Nov 2009, 8:10 AM
uh - isntead of submitting a form, why not just create the image tag, which contains the parameters for the form's submission?

OR

Submit the form, it returns a unique URL, then modify the image tag accordingluy.

hadi78
12 Nov 2009, 8:58 AM
Thx for the help. this is what i am trying now, but i don't know how can i create an image element with ext js?

12 Nov 2009, 9:03 AM
Thx for the help. this is what i am trying now, but i don't know how can i create an image element with ext js?

Look at the various examples and read the API.

Creating dom elements is easy as pie!

hadi78
16 Nov 2009, 2:15 AM
hi,

what i have accomplished now is to have a form. After submitting the form, the server code will generate an image for me and save it on the server.
then i have a BoxComponent object:




report_image = new Ext.BoxComponent({
id: 'report-image',
autoEl: {
tag: 'img',
src: '/images/report.png'
}
});

the image is requested form the server. My problem now is that when i submit the form again, the old image is still displayed and not the new one after submitting the form again. I guess it's because of the caching of the browser?!? Is there any way to force the BoxElement to get the image even its in the cache?

Animal
16 Nov 2009, 2:24 AM
Add "?" + new Date().valueOf() to the src URL?

hadi78
16 Nov 2009, 4:15 AM
ok this works, thx ;)