New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 363458 link

Starred by 5 users

Issue metadata

Status: WontFix
Owner:
Closed: Apr 2014
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 1
Type: Bug-Regression



Sign in to add a comment

Changes in 34 cause javascript validation of radio buttons to always fail

Reported by br...@pukkasoft.com, Apr 15 2014

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36

Steps to reproduce the problem:
1. Extract attached test case into a /lib folder of a web server
2. Load http://localhost/lib/chrome34-bug.html and click submit
3. The alert window pops up saying the field is required when it is already selected.  This validation returns successfully in other browsers and worked properly in Chrome 33.

What is the expected behavior?
The form should submit without a warning.

What went wrong?
It seems around line 767 in _f_getValue() in the /lib/qforms.js that Chrome 34 returns a different response now than it did in Chrome 33.  

Did this work before? Yes Chrome 33 (up until last week when the stable channel updated everyone)

Chrome version: 34.0.1847.116  Channel: stable
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)
Flash Version: Shockwave Flash 13.0 r0

The attached qForms library is quite old (dates back to 2007 in this build I believe) however it has always worked in all browsers so I don't think that should be the issue.
 
chrome34-javascript-radio-bug.zip
29.1 KB Download

Comment 1 by tkent@chromium.org, Apr 15 2014

Labels: -Cr-Blink-JavaScript -Pri-2 -Type-Bug Pri-1 Type-Bug-Regression Cr-Blink-Forms Cr-Blink-Forms-Radio Cr-Blink-Forms-Validation Needs-Bisect

Comment 2 by tkent@chromium.org, Apr 15 2014

Labels: -Cr-Blink-Forms-Validation

Comment 3 Deleted

Comment 4 by br...@pukkasoft.com, Apr 15 2014

I should note this is not limited to Windows - as far as we can tell from customer service calls and emails for our company, this is impacting all users of Chrome 34 including at a minimum these UAs which I've grabbed from our support requests:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36

Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36

Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36

Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36
Cc: srsridhar@chromium.org
Labels: Needs-Feedback
Tested the issue on Windows and Mac -chrome version 34.0.1847.116 and canary 36.0.1941.0 (Official Build 263744) . No alert window pops-out upon loading the .html file from below paths.

On MAC: file://localhost/Users/xxxxx/Library/lib/chrome34-bug.html
On WIndows: file:///C:/Users/xxxxxx/Documents/lib/chrome34-bug.html

Please let me know if I am missing out something in my repro case.


Comment 6 by keishi@chromium.org, Apr 15 2014

Owner: keishi@chromium.org
Status: WontFix
This is because RadioNodeList.value is returning a value. We used to return undefined.
According to the HTML spec (http://dev.w3.org/html5/spec-preview/common-dom-interfaces.html#dom-radionodelist-value)  RadioNodeLIst.value should "Return the value of the first checked radio button represented by the object." so I think Chrome is doing the correct thing.

For your code to work qforms.js line 767 needs to be changed.

Comment 7 by br...@pukkasoft.com, Apr 15 2014

Should the behavior be doctype specific if that is an html5 specification? I recognize in this example it has no doctype but in our actual usage it is XHTML 1.0 strict. 

We have run this code for 7 years and chrome appears to be the first ( desktop or mobile) to implement this. 

Comment 8 by keishi@chromium.org, Apr 15 2014

No. Chrome does not add doctype specific (or any) quirks mode.

FYI here is the issue that implemented this feature.
https://code.google.com/p/chromium/issues/detail?id=315851

Comment 9 by cdeci...@dspdsn.com, Apr 15 2014

We too are experiencing the same issue.  qForms has worked fine for several years and continues to work correctly in all browsers EXCEPT in Chrome v.34.  It's obvious to me this is an issue with Chrome and smells of a similar issue encountered nearly a year ago where Chrome broke the standard behavior of radio buttons, clearing them when autofill used in other fields.

I do not see anything on line 767 relating to radio buttons, only check boxes.

Please indicate when Chrome will have this fixed as our site is now blocked to all users of Google Chrome.

@keishi - I applaud adhering to the HTML spec however I'm hesitant to agree with the wontfix.  It gives me pause that no other browser has implemented this.  We did get complaints during the v34 beta but we assumed (incorrectly) that it was a bug that would be fixed before the stable was pushed.  I'm curious if this won't impact many more users/libraries?

@cdeci - here is a replacement for the _f_getValue() function in qforms.js, which starts on line 748:

// define Field getValue(); prototype
function _f_getValue(){
	var type = (this.type.substring(0,6) == "select") ? "select" : this.type;
	var value = new Array();

	if( type == "select" ){
		if( this.type == "select-one" && !this.container ){
			value[value.length] = (this.obj.selectedIndex == -1) ? "" : this.obj[this.obj.selectedIndex].value;
		} else {
			// loop through all element in the array for this field
			for( var i=0; i < this.obj.length; i++ ){
				// if the element is selected, get the selected values (unless it's a dummy container)
				if( (this.obj[i].selected || this.container) && (!this.dummyContainer) ){
					// append the selected value, if the value property doesn't exist, use the text
					value[value.length] = this.obj[i].value;
				}
			}
		}
	} else if( (type == "checkbox") || (type == "radio") ){
		// if more then one checkbox
		if( !!this.obj[0] && !this.obj.value ){
			// loop through all checkbox elements, and if a checkbox is checked, grab the value
			for( var i=0; i < this.obj.length; i++ ) if( this.obj[i].checked  ) value[value.length] = this.obj[i].value;
			// chrome 34 introduced support for HTML5 RadioNodeList which means obj.value is defined: https://code.google.com/p/chromium/issues/detail?id=363458
		} else if( !!this.obj[0] && this.obj.value ){
			value[value.length] = this.obj.value
			// otherwise, store the value of the field (if checkmarked) into the list
		} else if( this.obj.checked ){
			value[value.length] = this.obj.value;
		}
	} else {
		value[value.length] = this.obj.value;
	}
	return value.join(",");
}

So far, looks like it works.  Thank you @pukkasoft.com.  Hopefully this won't impact other browsers.

Comment 12 by Deleted ...@, Apr 17 2014

This is a major issue. Customers have started reporting errors with the latest Chrome build and it relates to this issue.

Comment 13 by agne...@gmail.com, Apr 21 2014

It also happens on checkbox!
It affects lots of customers.Please fix it ASAP!

While I wasn't planning on updating the source code for qForms (since it was originally written to support Netscape 2-4), I've just released an update w/the fix:

http://www.pengoworks.com/qforms/download/
Dan - cheers for the update.  Can you tell us if it includes anything other than what I pasted above (which so far has been working for me AFAICT)?

Comment 16 by tkent@chromium.org, Apr 25 2014

Cc: nyerramilli@chromium.org
 Issue 366227  has been merged into this issue.
 Issue 366227  has been merged into this issue.

Comment 18 by Deleted ...@, May 12 2014

Hi, I am getting the same issue with one of our client's site form http://www.astrologerpanditji.com/page6.htm . After selecting a service too, it gives an error that you should select atleast one service. This problem is chrome 34 specific.

Pl. let me know.

Thanks,
Sanjay

Comment 19 by Deleted ...@, May 15 2014

Hi, Any update on this?

Thanks,
Sanjay
I think the code on your page(http://www.astrologerpanditji.com/page6.htm) was broken from the beginning.

This line is the problem.

  else if(document.add_form["select_your_service[]"].value == "")

This condition was always false in old Chrome, because document.add_form["select_your_service[]"].value always returned undefined. So I think this validation wasn't working.

According to the HTML spec if there are multiple elements matching a name we should return RadioNodeList, and RadioNodeList.value should return the value of the first checked radio button. select_your_service[] elements are checkboxes not radio buttons so document.add_form["select_your_service[]"].value will return an empty string.

The HTML spec thinks of radios buttons as groups but checkboxes are not grouped and operate independently. You will need to scan the list of checkboxes and see if at least one is checked.

Comment 21 by Deleted ...@, May 16 2014

Hi, Thanks for your response but this form was working fine since 5 years. Pl. tell me the solution to correct it.

Comment 22 by Deleted ...@, May 18 2014

Any update on this?

Sign in to add a comment