Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #17053
| From | Martin Leese <please@see.Web.for.e-mail.INVALID> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: the right "form" element for ajax |
| Date | 2012-11-06 11:02 -0700 |
| Organization | A noiseless patient Spider |
| Message-ID | <k7bjbu$ref$1@dont-email.me> (permalink) |
| References | <015e6c83-d721-441b-8e07-5393238fe005@googlegroups.com> |
amado.alves@gmail.com wrote: > A recurring issue I see but could not find a definitive answer. > > When we send user data via AJAX the attribute "action" of the HTML element "form" is useless and even looks like it can get in the way. Usually we call the send data function right from the "onclick" event of a "button" element, and use the getElement functions to fetch the user input. There's no "action" in the "form". Actually we don't even need the "form" element at all. But per the HTML reference the "form" element is required and its "action" attribute too (or isn't it?) <form> tags and AJAX are quite separate; each can occur without the other. > Some browsers accept "input" fields and "button" elements without being enclosed in any "form" element. And accept "form" elements without the "action" attribute. But, strictly, this is illegal, right? A <button> or <input> tag outside of a <form> container is allowed. If you have a <form> tag then it needs an action attribute. (Under HTML 4.01, a value other than an HTTP URI is undefined. Under HTML 5, an empty URL is not allowed.) > So, the issue is: what we do? Rely on the permissive behavior of browsers, or write legal HTML and pray it does not interfere with our ajax? I see the Gmail interface has "form" elements with an empty "action" attribute. Would that be the "best practice"? No, an empty action attribute would not be best. -- Regards, Martin Leese E-mail: please@see.Web.for.e-mail.INVALID Web: http://members.tripod.com/martin_leese/
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
the right "form" element for ajax amado.alves@gmail.com - 2012-11-06 08:19 -0800
Re: the right "form" element for ajax Tim Streater <timstreater@greenbee.net> - 2012-11-06 17:08 +0000
Re: the right "form" element for ajax Martin Leese <please@see.Web.for.e-mail.INVALID> - 2012-11-06 11:02 -0700
Re: the right "form" element for ajax amado.alves@gmail.com - 2012-11-06 14:35 -0800
Re: the right "form" element for ajax Tim Streater <timstreater@greenbee.net> - 2012-11-06 22:52 +0000
Re: the right "form" element for ajax RobG <rgqld@iinet.net.au> - 2012-11-06 20:23 -0800
csiph-web