what you've assumed was almost everything correct, except the id_queue
observation. I use it, but I've just removed the code for we can focus on
the problem.

to debug, following your trips, I did this:

in line this.store.captureFile(tmp_input, url_local); I changed to
this.store.captureFile(document.getElementById(tmp_input.id), url_local);.
I've also put an alert to see what comes in tmp_input.id and it showed the
correct Id of the input. Nothing new happened

Thinking about d.getTime(), I changed the url_name to a simple string and
nothing has changed. The result keeps being an alert with the message object
error.

I also thought that the error was in I.E, or in my implementation, but as
much as I make tests, more I think it's a gears' bug. Do you have any other
suggestion to test?

2009/5/7 Eduard Martini <[email protected]>

>
> In this code:
>
> local_messages.prototype.send_attach_to_queue = function
> (id_queue,form) {
>        for(i=0;i<form.elements.length;i++) {
>            if(form.elements[i].name.indexOf("file_")!=-1) {
>                var tmp_input = form.elements[i];
>
>                var d = new Date();
>                var url_local = 'local_attachs/'+d.getTime();
>                 *this.store.captureFile(tmp_input, url_local);*
>            }
>        }
>    }
>
> I assume that:
>
> 1. form is a dom element something like form = getElementById
> (html_id_of_the_form_element)
> 2. code of this function is not complete because id_queue is not used
> in this function
> 3. you have a form with many <input type="file"... elements and you
> iterate across them and capture all files. If this is not the case and
> you have only one file element, do directlu tmp_input = getElementById
> (html_id_of_the_FILE_element);
>
> What I would do to debug this problem:
>
> 1. First I do not think this is a gears problem, I think this is an IE
> problem
> 2. I would remove all other code and test with a basic setup:
> Let only one file element in form, put an id on it and do something
> like:
>
> local_messages.prototype.send_attach_to_queue = function
> (id_queue,form) {
>
>                 tmp_input = getElementById
> (html_id_of_the_FILE_element);
>                var url_local = 'local_attachs/'test_file;
>                 this.store.captureFile(tmp_input, url_local);
>            }
>        }
>    }
>
> 3. If this works, I would put back the the code, but using i as
> dynamic url:
>
>
> local_messages.prototype.send_attach_to_queue = function
> (id_queue,form) {
>        for(i=0;i<form.elements.length;i++) {
>            if(form.elements[i].name.indexOf("file_")!=-1) {
>                var tmp_input = form.elements[i];
>                 var url_local = 'local_attachs/'+i;
>                *this.store.captureFile(tmp_input, url_local);*
>            }
>        }
>    }
>
> 4. if this still works, means the getTime() is the problem. As I know
> getTime() function can return object on IE on some cases instead of
> float.
>
> Hope this helps
>
>
> Please correct me if any of my assumption are incorrect.
>
> On May 6, 4:54 pm, Diogenes Duarte <[email protected]> wrote:
> > sorry, I forgot to say that I call init_local_messages before I call
> > send_attach_to_queue.
> >
> > 2009/5/6 Diogenes Duarte <[email protected]>
> >
> > > I can show you the code...
> >
> > > function local_messages() {
> > >         this.dbGears = null;
> > >         this.localServer = null;
> > >         this.store = null;
> > >     }
> >
> > > local_messages.prototype.init_local_messages = function(){
> > >         if(this.dbGears == null)
> > >             this.dbGears =
> google.gears.factory.create('beta.database');
> > >         if(this.localServer==null)
> > >             this.localServer =
> > > google.gears.factory.create('beta.localserver');
> > >         if(this.store==null)
> > >             this.store = this.localServer.createStore('test-store');
> > > }
> >
> > > local_messages.prototype.send_attach_to_queue = function(id_queue,form)
> {
> > >         for(i=0;i<form.elements.length;i++) {
> > >             if(form.elements[i].name.indexOf("file_")!=-1) {
> > >                 var tmp_input = form.elements[i];
> >
> > >                 var d = new Date();
> > >                 var url_local = 'local_attachs/'+d.getTime();
> > >                 *this.store.captureFile(tmp_input, url_local);*
> > >             }
> > >         }
> > >     }
> >
> > > After bold line, on I.E, the app shows an alert with the message:
> "object
> > > error". In firefox it works perfectly. I can't imagine why this is
> > > happening... does anyone can see why?
> >
> > > I know the method is deprecated, but I can't change all my code to
> change
> > > deprecated methods. at least, not now. we have plans for doing that in
> 2 or
> > > 3 months, but, for now I really need the methods doing what they say
> they
> > > do, even the deprecateds.
> >
> > > thanks for attention.
> >
> > > 2009/5/5 carise <[email protected]>
> >
> > >> Hi,
> >
> > >> Can you provide your code (especially the javascript)?
> >
> > >> On May 5, 6:10 am, Diogenes Duarte <[email protected]> wrote:
> > >> > I have an app using captureFile method and it's working fine on
> firefox,
> > >> but
> > >> > crashes in I.E. It's the same code in both browsers, and in I.E
> shows an
> > >> > alert that says: "Object Error". In the end, the function doesn't
> work.
> >
> > >> > Any idea why this is happening?
> >
> > >> > thanks for attention.
>

Reply via email to