473,320 Members | 1,821 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Submit button nested in a link element behavior

Here's an example:

<form action="bogus" method="post">
<p>
<a href="prev.cgi"><input type="submit"
name="prev" value="< Back"></a>
<a href="next.cgi"><input type="submit"
name="next" value="Next >"></a>
</p>
</form>

A person who have tried to use the above structure is citing the
HTML spec about what is supposed to happen when the submit button is
pressed
<http://www.w3.org/TR/REC-html40/interact/forms.html#idx-form-12>:
Finally, the encoded data is sent to the processing agent designated
by the action attribute using the protocol specified by the method
attribute.


According to the HTML spec: "Nested links are illegal"
<http://www.w3.org/TR/html401/struct/links.html#idx-link-6>. But in
the given example there are no nested links. There's a form button
nested in a link and (at least) I haven't found section in the spec
which explicitly forbids this or at least states this would have
undefined behavior. So is the example permissible and the behavior
defined?

The man has particularly mentioned the difference in the behavior in
IE and Mozilla/Netscape. IE does submit the form and Netscape
follows the link. He thinks Mozilla/Netscape behaves non-standard
compliant in this case. I'm pretty sure this is more omission in the
HTML spec and the behavior is pretty much undefined. Again, what
should be the standard compliant behavior in the given case?

Further, I've made the following test using javascript:

<a href="prev.cgi" onclick="return false"><input
type="submit" name="prev" value="< Back"></a>

IE ceases to submit the form although the event (I think) shouldn't
reach the link 'A' element. The event should be processed in the
same way as if there was no 'onclick' on the link element.

--
Stanimir

Jul 20 '05 #1
1 8296
Stanimir Stamenkov <s7****@netscape.net> wrote:
Here's an example:

<form action="bogus" method="post">
<p>
<a href="prev.cgi"><input type="submit"
name="prev" value="< Back"></a>
<a href="next.cgi"><input type="submit"
name="next" value="Next >"></a>
</p>
</form>
It is indeed complete bogus, and pointless. Links should be used for
linking. See http://www.cs.tut.fi/~jkorpela/www/links.html
A person who have tried to use the above structure is citing the
HTML spec about what is supposed to happen when the submit button
is pressed
Well, a browser might treat a click on the button as activating the
submit, or as activating the link, or both, or neither. What happens
when you use a particular device in a particular way is mostly not a
business of the HTML specification. It's a user agent's user interface
issue - though admittedly it might be better if the spec said something
about this.
Finally, the encoded data is sent to the processing agent
designated by the action attribute using the protocol specified by
the method attribute.


Well, "bogus" is a (relative) URL, so _if_ such a thing happens, it
would be the resource addressed by that URL that processes the data.
I wonder what that would be.
According to the HTML spec: "Nested links are illegal"
<http://www.w3.org/TR/html401/struct/links.html#idx-link-6>. But in
the given example there are no nested links.
That is a correct observation.
There's a form button
nested in a link and (at least) I haven't found section in the spec
which explicitly forbids this or at least states this would have
undefined behavior.
It explicitly allows it in the DTDs, since <input> elements are inline
elements and all inline elements except <a> elements are allowed inside
an <a> element. But what it really means is rather unspecified.
Again,
what should be the standard compliant behavior in the given case?
The HTML "standard" does not specify the user interface. Activating
buttons and links could take place via voice, keyboard, blinking an
eye, or via a device that physically detects brain activity, for
example. (ESP is not excluded by the specification either, but I'm
trying to keep this realistic.) If it is possible to do such things by
using a pointing device, then it is the browser designer's privilege
and duty to decide what happens when you click on a point that belongs
both to an <a> element that is a link and to an <input> element (or
<select> element, or <textarea> element).
Further, I've made the following test using javascript:

<a href="prev.cgi" onclick="return false"><input
type="submit" name="prev" value="< Back"></a>

IE ceases to submit the form although the event (I think) shouldn't
reach the link 'A' element. The event should be processed in the
same way as if there was no 'onclick' on the link element.


The onclick attribute is pretty vaguely defined in the HTML
specification, and there's really no answer to the question what should
happen here. If you click on that stuff, there's nothin that prevents
from treating it (by the browser's UI definition) as a click on the
<a> element only, for example - hence no triggering of a form
submission.

But it's far better not to create the problem in the first place than
to try to find ways to remove part of its consequences.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Victor A. Cuya | last post by:
Hello all, I have been trying to solve an annoying behavior with PHP (I think). Maybe some of you have encountered the same and have some ideas. I have an html form and I use an <input...
4
by: Sarah | last post by:
Hi all. I have a form, and several text and image links on it that should submit the form with different actions. I prepared a simple page with just the code that's not working. PROBLEM:...
2
by: Martin Nadoll | last post by:
Hello, i try to submit a form with textlink like this snippet: <a href="javascript:document.bestellen.submit()">bestellen</a> <form name="bestellen" method="post"...
2
by: Cardinal | last post by:
In the application I'm developing, I need a link to behave as a form submit. I set up a little test example below and it worked fine: <table> <tr> <form action="action1.cfm" method="POST"...
5
by: terence.parker | last post by:
I have a PHP application which I wrote last year - and the JavaScript worked fine then. For some reason, now it doesn't - neither on IE nor Firefox. Has something changed? When I click on my...
16
by: Ben Sharvy | last post by:
I want to get the user's choice of some menu items, and pass them to a (PHP) page in the URL, rather than with "Submit" button. I tried this, but it doesn't work: <a...
14
by: charlie_M | last post by:
Is there a way to blank the screen in a FORM's onsubmit=... to blank the screen for the user?? I asked this before and got a way to blank a table by id with ...
5
by: Alex Maghen | last post by:
In ASPX 2.0 with MasterPages and all that, my entire page only has one actual <FORM>. But there are several different sections of the page that provide what are functionally separate forms with...
5
by: Simon Benson | last post by:
Probably a fairly simple problem but one that's been plaguing me for a couple of days... can anyone help? I have a classic ASP page with a number of text boxes which are updatable. For...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.