Closed Bug 347988 Opened 19 years ago Closed 17 years ago

button tag does not submit when form action attribute starts with forward slash ('/')

Categories

(Firefox :: General, defect)

1.5.0.x Branch
x86
Windows 2000
defect
Not set
minor

Tracking

()

RESOLVED INVALID

People

(Reporter: leo.mekenkamp, Unassigned)

Details

(Whiteboard: closeme 2009-04-25)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6 When using a button tag instead of a submit tag, firefox does not post the form when the action attribute in the form tag starts with a forward slash ('/'). Reproducible: Always Steps to Reproduce: 1. create a file 'bug.html' with the following lines: <html> <body> <form action="/bla"> <button type="submit">press me</button> </form> </body> </html> 2. load the file in firefox 3. press the 'press me' button Note that when one removes the '/' from the action tag in form, pressing the 'press me' button results in the expected behaviour. Actual Results: nothing happens Expected Results: error message that file 'bla' could not be found
Thats because / is not a valid start (from the current directory which is terminated with a /). You'll see this because if you use ./ it works fine... <form action="./bla.php" method="post"> <button type="submit">press me</button> </form> Works fine so I'm guessing this is invalid.
Haven't gotten around to trying to repro yet, but... (In reply to comment #1) > Thats because / is not a valid start (from the current directory which is > terminated with a /). You'll see this because if you use ./ it works fine... > Works fine so I'm guessing this is invalid. Reporter's description, comment #0, implies that the current behavior varies from submit tag to button tag, with constant action attribute value. Feel free to correct me, but shouldn't these tags produce consistent behavior?
The html 4 specs from the W3C specify the action attribute as a URI (section 17.3: http://www.w3.org/TR/html4/interact/forms.html#h-17.3). In http://www.ietf.org/rfc/rfc2396.txt, chapter 5 on 'page 16', we read: "A relative reference beginning with a single slash character is termed an absolute-path reference, (...)" which to me seems to imply that it is legal to start a (relative) URI in the action attribute of a form tag with a forward slash.
For me it works the same if its <button type="submit">press me</button> ot <input type="submit" value="press me" /> It also seems to work as expected when the paths are correct so I'd still say this is invalid...
It seems firefox treats local html files differently than files loaded over a webserver when it comes to the action attribute in a form starting with a '/'. By the way, the implied difference in submit and button tags came from including either a strange css or a strange js file. Original point still stands though: an errormsg is preferable over nothing happening at all.
Severity: major → minor
Summary: button tag does not submit when form action acctribute starts with forward slash ('/') → button tag does not submit when form action attribute starts with forward slash ('/')
(In reply to comment #0) > 1. create a file 'bug.html' with the following lines: >(snip) > <form action="/bla"> Where(which directry) do you put the 'bug.html' file? Assume c:\dir1\dir2\bug.html. (1) URI of this html : file:///c:/dir1/dir2/bug.html (No <net_loc> format in shceme://<net_loc>/<path-1>/<path-2>/..., ) (or special <net_loc> of "/c:" for drive letter on MS Win support) (2) Base URI(default since no <BASE>) : file:///c:/dir1/dir2/bug.html (3-A) When relative path (3-A-1) action='bla' : URI = file:///c:/dir1/dir2/bla (3-A-2) action='./bla' : URI = file:///c:/dir1/dir2/bla (This is Comment #1 and Comment #4 by Ryan Jones) (3-A-3) action='../bla' : URI = file:///c:/dir1/bla (3-B) When absolute path (3-B-1) action='/bla' : URI = file:///bla (or file:///c:/bla) To Leo Mekenkamp(bug opener) : Are you saying URI=file:///c:/dir1/dir2/bla is used if "<input type='submit'>" instead of "<button type='submit'>"? Do you put <base href='http://x.y.z/a/b/c...'> in your HTML for real environment(loaded from server)?
(...) > Where(which directry) do you put the 'bug.html' file? Both in the root of the c: drive as wel as in a subdirectory of c:. (...) > (3-B) When absolute path > (3-B-1) action='/bla' : URI = file:///bla (or file:///c:/bla) > > To Leo Mekenkamp(bug opener) : > Are you saying URI=file:///c:/dir1/dir2/bla is used if "<input type='submit'>" > instead of "<button type='submit'>"? No, at first I thought there was a difference between the button and input tags, but that was caused by something else (not ff related). > Do you put <base href='http://x.y.z/a/b/c...'> in your HTML for real > environment(loaded from server)? No such tag is in the html.
(In reply to comment #7) > Both in the root of the c: drive as wel as in a subdirectory of c:. > > Do you put <base href='http://x.y.z/a/b/c...'> in your HTML for real > > environment(loaded from server)? > No such tag is in the html. You MUST specify absolute-path correctly, if you intentionally use absolute-path specification. ie. specify "/c:/foo" as absolute-path when using file: protocol for local file on MS Win. Please note that it doesn't work when file under Apache server thru http:. (Sorry but I don't know MS's IIS case, who usually ignore Web standards. :-) ) When your files are placed at server and accessed thru http:, Base-URI becomes (A) http://a.b.c/bug.html, or (B) http://a.b.c/xxx/.../zzz/bug.html(placed under sub-directory). When (A), "/foo"(aboslute-path) becomes http://a.b.c/foo, then link of "/foo" in bug.html works as you expected. But when (B), "/foo"(aboslute-path) becomes http://a.b.c/foo too, then foo placed under /xxx/.../zzz/ can not be accessed. Use relative path representation always if you want same "link" or "form action" specification to work well in both file: and http:. As Ryan Jones says repeatedly, INVALID.
Version: unspecified → 1.5.0.x Branch
do you see this problem when using FF3? Or better yet, current beta of 3.1? http://www.mozilla.com/en-US/firefox/all-beta.html
Whiteboard: closeme 2009-04-25
I see the same behaviour for both input and button tags in 3.0.8. As far as I'm concerned this bug can be closed.
Status: UNCONFIRMED → RESOLVED
Closed: 17 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.