Help - Search - Members - Calendar
Full Version: Multiple form elements
HTMLHelp Forums > Web Authoring > Markup (HTML, XHTML, XML)
Christian J
In a file upload form I use two submit buttons (with different names), one for uploading files, and another for removing previously uploaded files. But if the path to a local file is invalid Opera9 doesn't let you submit the form, not even with the submit button meant for removing files. To avoid this slight annoyance I'm thinking of using separate forms for the two tasks.

Are special considerations needed if you want to use more than one FORM element on the same page (all using the same ACTION value)? E.g., I notice that a Reset button in one form also resets the other (in all my browsers).
Brian Chandler
QUOTE(Christian J @ Jul 16 2009, 03:15 AM) *

In a file upload form I use two submit buttons (with different names), one for uploading files, and another for removing previously uploaded files. But if the path to a local file is invalid Opera9 doesn't let you submit the form, not even with the submit button meant for removing files. To avoid this slight annoyance I'm thinking of using separate forms for the two tasks.

Are special considerations needed if you want to use more than one FORM element on the same page (all using the same ACTION value)? E.g., I notice that a Reset button in one form also resets the other (in all my browsers).


It seems more logical to use two separate forms, since the input elements must be different: to upload, you select the file on your own computer you want to send; to delete, you just choose the file you want to delete.

Any browser that jumbles up the inputs to two separate forms (whether they access the same page or not) is badly written. What you say Opera does with the Reset button seems to me to be an error/bug too, though I wouldn't personally bother about it, since I don't think you should ever use a Reset button -- they have no obvious use other than inducing operator error.

If you should find a browser (or BLOSC) that does somehow screw up if the actions are the same, I suppose you could always add a dummy argument to make them different.

action="myprog.php?pip=pop"
action="myprog.php?pup=pap"

but to have to do this would be pretty silly I think.

Christian J
QUOTE(Brian Chandler @ Jul 16 2009, 04:25 PM) *

What you say Opera does with the Reset button seems to me to be an error/bug too

Oops. blush.gif It was a sloppily written javascript that caused the strange Reset behavior. Opera and my other browsers are innocent.

(Can't understand why on earth I let the JS reset form elements (this was written back when I used a single form on the page), when resetting is exactly what a Reset button is meant for in the first place. Must have forgotten to remove a line of code in the JS that didn't cause any harm until I created two forms.)

QUOTE
I don't think you should ever use a Reset button -- they have no obvious use other than inducing operator error.

It might be useful in order to unselect the file meant for uploading, since that's not otherwise possible in some browsers unless you reload the page. Being able to unselect might be useful (in a form with a single submit button) if the user changes his mind about the file upload, but still wants to submit the other forms fields.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.