Re: Forms in table cells modify cell height - grrr



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/

.



Relevant Pages

  • Re: Forms in table cells modify cell height - grrr
    ... and it has been required ever since HTML ... a page might be generated by JavaScript code but the ... The user base is our engineers, our NOC's engineers, and some of ... Posting a URL is still the best approach in HTML problems. ...
    (alt.html)
  • Re: urgent:reading 2 files into 2 different $ variables
    ... javascript code ... html table. ... Those characters need to be quoted so they don't have their meta-meanings, but are considered as ordinary characters to be matched. ...
    (comp.lang.perl.misc)
  • Re: on page exit
    ... or JavaScript code whenever the user exits a document." ... of which JavaScript is only one. ... used in HTML with intrinsic event handler attribute values, ... If that would be OK for you, you should use the `onunload' event handler ...
    (comp.lang.javascript)
  • Re: W3C html validator flags error in javascript
    ... HTML is invalid. ... The validator is flagging erroneous errors, ... poorly written javascript code fools the html validator into thinking ...
    (alt.html)
  • Re: fontsize and color
    ... of javascript code. ... Avoid exotic fonts like "Comic Sans MS", and always provide a generic font ... In a HTML `script' element you have to ... Prototype.js was written by people who don't know javascript for people ...
    (comp.lang.javascript)