Closed Bug 277661 Opened 20 years ago Closed 20 years ago

OnClick has no effect on Submit-button.

Categories

(Toolkit :: Form Manager, defect)

x86
Windows XP
defect
Not set
minor

Tracking

()

RESOLVED INVALID

People

(Reporter: henrik, Assigned: bugs)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; sv-SE; rv:1.7.5) Gecko/20041108 Firefox/1.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; sv-SE; rv:1.7.5) Gecko/20041108 Firefox/1.0

If you press a Submit button containing OnClick the form will processed no
matter what the javascript says.

Example:
<input name="submitbutton" onClick="javascript:if(confirm('Submit form?!'))
{document.editart.submit();}" type="submit" value="Submit">

In this case the submit should be interupted if you chose 'Cancel' and processed
if you press 'Ok'.

Reproducible: Always

Steps to Reproduce:
1.Press button
2.Press cancel

Actual Results:  
The form is processed.

Expected Results:  
Nothing.
If you want to completely handle clicks, and not have the default action occur
at all, you have to return false; in your handler:
onClick="javascript:if(confirm('Submit form?!'))
{document.editart.submit();}; return false;
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
Product: Firefox → Toolkit
You need to log in before you can comment on or make changes to this bug.