Folks, When I try to get the array form form.getElements(); In FileFox or Netscape it works fine, but if I try the same code in IE 7 I get an "Object doesn''t support this property or method" here is the code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http:// www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <meta name="author" content="David Gens"> <title>Button Test</title> <script src="/bgeJS/prototype-1-6.js"></script> <script src="/bgeJS/AJAXhelper.js"></script> <script> function myshow(form) { alert("got here"); tmp = form.getElements(); out = ''''; for(i=0 ; i< tmp.length; i++){ out += tmp[i].name+" "+tmp[i].type+"\r\n"; } alert(out); myHead = document.getElementsByTagName(''head''); alert(myHead[0].innerHTML); } </script> </head> <body> <form> test: <input name="atest" type="text"></input><br /> <input type="button" name="submit" value="Submit Form" onClick="myshow(this.form);"></input> <input type="reset" name="reset" value="Reset Form"></input> </form> </body> </html> if anyone has any ideas why this is and what I can do about it please let me know thanks s --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On Dec 6, 2007 5:57 PM, dmgens <david-ai3HjtyLJXqeS2mSZxZSLkEOCMrvLtNR@public.gmane.org> wrote:> > tmp = form.getElements(); > > if anyone has any ideas why this is and what I can do about it please > let me knowIE doesn''t automatically extend elements, sad to say. Try tmp $(form).getElements(); instead; by wrapping from in the $ function, you''re "manually" extending it, which gives you access to all the Prototype goodness. :Dan Dorman --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On Dec 6, 6:03 pm, "Dan Dorman" <dan.dor...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Dec 6, 2007 5:57 PM, dmgens <da...-ai3HjtyLJXqeS2mSZxZSLkEOCMrvLtNR@public.gmane.org> wrote: > > > > > tmp = form.getElements(); > > > if anyone has any ideas why this is and what I can do about it please > > let me know > > IE doesn''t automatically extend elements, sad to say. Try tmp > $(form).getElements(); instead; by wrapping from in the $ function, > you''re "manually" extending it, which gives you access to all the > Prototype goodness. > > :Dan DormanThanks Dan, Works fine now, Just have to code everythingmore carefully in the future --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
dmgens wrote:> Folks, > > When I try to get the array form form.getElements(); In FileFox or > Netscape it works fine, but if I try the same code in IE 7 I get an > "Object doesn''t support this property or method" > > here is the code: > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http:// > www.w3.org/TR/html4/loose.dtd"> > <html> > > <head> > <meta http-equiv="content-type" content="text/html; > charset=iso-8859-1"> > <meta name="author" content="David Gens"> > > <title>Button Test</title> > <script src="/bgeJS/prototype-1-6.js"></script> > <script src="/bgeJS/AJAXhelper.js"></script> > <script> > function myshow(form) { > alert("got here"); > tmp = form.getElements();You could also use: var tmp = document.forms[0].elements Don''t forget to declare variables, it''s a bad idea to let them become global for no good reason (especially loop counters like i below).> out = ''''; > for(i=0 ; i< tmp.length; i++){ > out += tmp[i].name+" "+tmp[i].type+"\r\n"; > } > alert(out); > myHead = document.getElementsByTagName(''head''); > alert(myHead[0].innerHTML); > } > </script> > </head> > > <body> > <form> > test: <input name="atest" type="text"></input>That is invalid HTML: the end tag for input elements is forbidden. <URL: http://www.w3.org/TR/html4/interact/forms.html#edef-INPUT >> <br /> > <input type="button" name="submit" value="Submit Form"It is a bad idea to name any form control "submit", it shadows the form''s submit method so you can''t call it. -- Rob --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Now Rob mentions it, i''ve been bitten by the ''submit'' before, took me over an hour to figure out why form.submit() wasnt working! Gareth On Dec 8, 2007 11:26 AM, RobG <rgqld-AFFH1GffN5hPR4JQBCEnsQ@public.gmane.org> wrote:> > > > dmgens wrote: > > Folks, > > > > When I try to get the array form form.getElements(); In FileFox or > > Netscape it works fine, but if I try the same code in IE 7 I get an > > "Object doesn''t support this property or method" > > > > here is the code: > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http:// > > www.w3.org/TR/html4/loose.dtd"> > > <html> > > > > <head> > > <meta http-equiv="content-type" content="text/html; > > charset=iso-8859-1"> > > <meta name="author" content="David Gens"> > > > > <title>Button Test</title> > > <script src="/bgeJS/prototype-1-6.js"></script> > > <script src="/bgeJS/AJAXhelper.js"></script> > > <script> > > function myshow(form) { > > alert("got here"); > > tmp = form.getElements(); > > You could also use: > > var tmp = document.forms[0].elements > > Don''t forget to declare variables, it''s a bad idea to let them become > global for no good reason (especially loop counters like i below). > > > out = ''''; > > for(i=0 ; i< tmp.length; i++){ > > out += tmp[i].name+" > "+tmp[i].type+"\r\n"; > > } > > alert(out); > > myHead = document.getElementsByTagName(''head''); > > alert(myHead[0].innerHTML); > > } > > </script> > > </head> > > > > <body> > > <form> > > test: <input name="atest" type="text"></input> > > That is invalid HTML: the end tag for input elements is forbidden. > > <URL: http://www.w3.org/TR/html4/interact/forms.html#edef-INPUT > > > > > <br /> > > <input type="button" name="submit" value="Submit Form" > > It is a bad idea to name any form control "submit", it shadows the > form''s submit method so you can''t call it. > > > -- > Rob > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---