checkbox does submit name and value if checked and a click submits the form

UNCONFIRMED
Unassigned

Status

()

Core
HTML: Form Submission
UNCONFIRMED
9 years ago
9 years ago

People

(Reporter: Karsten Ohme, Unassigned)

Tracking

1.9.0 Branch
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

9 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1 (.NET CLR 3.5.30729)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1 (.NET CLR 3.5.30729)

<input type="checkbox" onclick="$('SubmitPayment').submit();" name="foo" value="bar" id="myid checked="true"/>

Reproducible: Always

Steps to Reproduce:
1. <input type="checkbox" onclick="$('SubmitPayment').submit();" name="foo" value="bar" id="myid checked="true"/>
2. click the checkbox
Actual Results:  
post data does no contain name value pair

Expected Results:  
post data does contain name value pair

Plugin Firebug and LiveHTTPHeader and WebDeveloper are installed
(Reporter)

Updated

9 years ago
Version: unspecified → 3.0 Branch
Seems to be problems in the html code you included in the initial comment and it doesn't match what you put in the bug summary. But taking a rough guess, doesn't clicking on a checkbox unselect it, that it also submits it is perhaps a side issue. Are you somehow expecting that clicking it should submit and not behave like a normal checkbox?
(Reporter)

Comment 2

9 years ago
Like in the example clicking the selectbox always submits the form. You see the Javascript submit function? Have you tried it? What's the problem if the summary is not the same?
(In reply to comment #2)
> Like in the example clicking the selectbox always submits the form. You see the
> Javascript submit function? Have you tried it? What's the problem if the
> summary is not the same?

The problem is that the summary and your last comment talk about a "selectbox", which is not even a valid input type. The initial description talks about a "checkbox" which is valid and so I've assumed that is what you are really talking about. Can I confirm that that is the case and get the summary updated to match?

In yes you have a click handler to submit the form on clicking, but clicking a checkbox also toggles it, something you haven't prevented. So the problem seems to be that you expect it to submit the form without toggling the checkbox whereas I believe it is doing both.
(Reporter)

Comment 4

9 years ago
Yes, you are right. It is a valid checkbox. The toggling should occur. I do not want to prevent it. Its not my problem. I just want to persist the clicking on server side. The name value pair is not transmitted. But it works if cheched="checked" is not given.
Well that would be because clicking on the checkbox checks it and submits the form. I tend to think that this is invalid.
Component: General → HTML: Form Submission
Product: Firefox → Core
QA Contact: general → form-submission
Summary: input type="selectbox" onclick="<name>.submit();" does submit name and value if checked="checked" → checkbox does submit name and value if checked and a click submits the form
Version: 3.0 Branch → 1.9.0 Branch
(Reporter)

Comment 6

9 years ago
Activating works. It is is already checked. checked=checked. Clicking in this state is a problem on my side. Then the checkbox is submitted, but the name and value is not transmitted.
You need to log in before you can comment on or make changes to this bug.