Form submit not working on IE

4 views
Skip to first unread message

JC

unread,
Jul 8, 2009, 1:57:24 PM7/8/09
to Prototype & script.aculo.us
Here's my function:

function AutosaveForm(formthis){
var alertTimerid = 0;
new Form.Observer('checkform', 0.3, function(){
clearTimeout (alertTimerid);
alertTimerid = setTimeout (function(){
formthis.request({
onComplete: function(){alert('Form data saved!')}
})
}, 1000)
})
}

I call AutosaveForm from html in the page. In Firefox it works fine,
after 1 second after the form is modified it submits the results and
alerts me that the data was saved. But in IE it just alerts me that
it was saved but doesn't actually save the data that was modified,
when I refresh the page its the old data. Any Ideas?

T.J. Crowder

unread,
Jul 9, 2009, 9:03:21 AM7/9/09
to Prototype & script.aculo.us
Hi,

I don't know what's wrong, but I do have a couple of observations for
you -- they might help, you never know.

1. On this line:

new Form.Observer('checkform', 0.3, function(){

Since the function is otherwise reusable for multiple forms, I wonder
if you might want:

new Form.Observer(formthis.id, 0.3, function(){

...instead (or formthis.identify() if there's a chance that forms will
be passed in that don't have an ID). Otherwise, I could call
AutosaveForm($("myform")) and end up submitting changes to "myform"
when "checkform" changes, which probably isn't what you want.

2. You're relying on semicolon insertion. Semicolon insertion is a
very, very bad thing (especially when you start wanting to minify your
code for deployment), I would suggest _never_ relying on it. (But I
don't immediately see any reason to believe that's what's wrong.)

3. IE has this confusion around IDs and NAMEs, it puts them in the
same namespace although that's clearly completely wrong. I don't
suppose there might be something else on the page that has *either* a
name or id attribute with the value "checkform"? Because if there is,
it's anyone's guess which one will get picked at runtime, the behavior
is not reliable cross-browser. IDs (as I'm sure you know) must be
completely unique within the page, and with IE you also have to worry
about names getting conflated with them as well. Great fun.

FWIW (which may be nothing -- but I'd love to hear if one of those was
it),
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available

JC

unread,
Jul 9, 2009, 11:23:12 AM7/9/09
to Prototype & script.aculo.us
Ok so I modifed the function to suggestions on 1 and 2 just incase:

function AutosaveForm(formthis){
var alertTimerid = 0;
new Form.Observer(formthis, 0.3, function(){
clearTimeout (alertTimerid);
alertTimerid = setTimeout (function(){
formthis.request({
onComplete: function(){alert('Form data saved!');}
});
}, 1000);
});
}

3 was my first guess but I can't find any duplicates. I even went as
far are renaming the form to "aardvark" something thats def not
sharing that name/id with some other element and it still is a no go.
The form itself has name and ID specified as the same, I tried
removing the name, and then the ID to make sure it wasn't some funky
conflict there and still the same issue.

Any other ideas?

Miguel Beltran R.

unread,
Jul 9, 2009, 6:31:08 PM7/9/09
to prototype-s...@googlegroups.com

2009/7/9 JC <mims...@gmail.com>

on server side can you add a log? create a file when request is recived with request information.
or using some debug (like firebug) for see what page is request.
for debug the problem.

I had a problem using IE8 + Zope 2.11
I maded a request to "print.htm" -> request http://fooserver.com/app/dir1/print.htm

Using FF the request was http://fooserver.com/app/dir1/data/print.htm what is correct.
The actual page where made the page is http://fooserver.com/app/dir1/data/index.htm

So at last change the request from "print.htm" to "data/print.htm". (Zope can handle with this without problem. how not find data in data, go up a level -dir1- and load data/print.htm)
 

T.J. Crowder

unread,
Jul 10, 2009, 3:45:27 AM7/10/09
to Prototype & script.aculo.us
Hi,

Yeah, #3 was my top guess as well. :-(

Time to pick up with the third step on this list (small, self-
contained example):
http://proto-scripty.wikidot.com/faq#xyzprob

HTH,
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available


Reply all
Reply to author
Forward
0 new messages