Closed Bug 277711 Opened 20 years ago Closed 20 years ago

Multiple submit buttons

Categories

(Firefox :: General, defect)

1.0 Branch
x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: mikes, Assigned: bugzilla)

Details

In the example form below there are two submit buttons with the same name. 

Expected Behaviour: If you click on "Save" firefox posts the "Save" value.

Actual behaviour: If you click on "Save" firefox fires the onClick event for the
"Delete" button and posts the "Delete" value.

<form action="cgi.script" method="post">
	
	<fieldset id="details">
	<legend>Edit Details</legend>
		<label>Name:<input name="name" type="text" value="" /></label>
		<label>Description:<textarea name="description" wrap="virtual" rows="4"
cols="40"></textarea>
		<label>URL:<input name="url" type="text" value="" /></label>
	 	<label><input type="submit" name="doAction" value="Delete" onClick="return
confirm('are you sure?');" /><input type="submit" name="doAction" value="Save"
/></label>
	</fieldset>
	
</form>
Both those buttons are in the same label, so you're basically seeing the same
issue as bug 218788. Code that would work is:

<label>
Delete <input type="submit" name="doAction" value="Delete" onClick="return
confirm('are you sure?');" />
</label>
<label>
Save <input type="submit" name="doAction" value="Save"/>
</label>

See http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.9.1 .
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.