Re: Forms in table cells modify cell height - grrr
- From: "Jukka K. Korpela" <jkorpela@xxxxxxxxx>
- Date: Sat, 7 Jul 2007 20:54:27 +0300
Scripsit Tim Streater:
Both action and method are required attributes.
Hmm, I understood action to be optional.
There's some confusion here. In a <form> element, the method="..." attribute is and always was optional, with the default value being "GET". The action="..." attribute is required, and it has been required ever since HTML 4.0.
And that without it, the
default action was that the same form reloaded.
Well, the same _page_. In HTML 3.2, the action="..." attribute was optional, with the default value being the URL of the page on which the form appears. Browsers might still behave that way, but it's not a good idea to use invalid markup and to rely on behavior that is holdover from some previous version.
Additionally, I could
well want to go to different places depending on the button pushed or
the data that the form passes off to some Javascript.
You might want that, but can you do that reliably?
I don't want to
show an action that will never be taken - that just confuses whoever
follows me on the code. I could imagine something like <form
action="none" ... > to make this explicit but can;t recall ever having
seen such an option.
There is no such option. By HTML versions from HTML 4.0 onwards, the meaning of a form element is undefined unless it has an action attribute with a http URL.
If a form exists only for the purpose of JavaScript-based interaction, then the form, and perhaps the entire page, should be JavaScript-generated so that it does not appear when it does not work. Even then, a conforming action="..." attribute _is_ useful. It's a sentinel against errors that may arise when the form is, after all, used in a browser where scripting is not enabled. (For example, a page might be generated by JavaScript code but the user might then disable scripting. To take a less far-fetched example, an author might just goof things up and e.g. omit the JavaScript code that prevents normal form submission.)
The sentinel attribute could be action="error.html" where error.html is a document that explains that an unexpected error occurred. You might write a longer explanation if you like, but most users probably wouldn't understand it. What matters is that users are informed about an error, instead of just weird behavior or everything going well on the surface while everything is broken.
Yes, I see that - but I did try to emphasise that I had cut down the
example to the minimum required to demonstrate my problem. I have
seen, in other groups, people post 1000 lines of code and ask why it
doesn't work,
Posting a URL is still the best approach in HTML problems. If you don't have a URL, create one. It doesn't take that long to compose a valid document and upload it on a server.
--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/
.
- Follow-Ups:
- Re: Forms in table cells modify cell height - grrr
- From: Tim Streater
- Re: Forms in table cells modify cell height - grrr
- References:
- Forms in table cells modify cell height - grrr
- From: Tim Streater
- Re: Forms in table cells modify cell height - grrr
- From: Tim Streater
- Re: Forms in table cells modify cell height - grrr
- From: Tim Streater
- Forms in table cells modify cell height - grrr
- Prev by Date: Html forms, xml and Xforms?
- Next by Date: JSTE (Javascript Templating Engine for Java) available
- Previous by thread: Re: Forms in table cells modify cell height - grrr
- Next by thread: Re: Forms in table cells modify cell height - grrr
- Index(es):
Relevant Pages
|