Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Cannot set numerical 0 values to form fields. #2164

Closed
rhuynh opened this Issue · 1 comment

2 participants

@rhuynh

In mootools 1.4.2., you can no longer set a form field's value to 0, eg, myTextBox.set('value', 0). It always result in an empty string. This used to work in mootools 1.2.5.

I believe the error is in the property setter for 'value'. Instead of:

Object.append(propertySetters, {
'class': function(node, value){
('className' in node) ? node.className = (value || '') : node.setAttribute('class', value);
},
....
'value': function(node, value){
node.value = value || '';
}

});

it should be:

Object.append(propertySetters, {
'class': function(node, value){
('className' in node) ? node.className = (value || '') : node.setAttribute('class', value);
},
....
'value': function(node, value){
node.value = [value, ''].pick();
}

});

Tested On: Firefox, Safari, and IE9

jsFiddler:
http://jsfiddle.net/uYWgf/2/

@ibolmo
Owner
@ibolmo ibolmo closed this issue from a commit
@ibolmo ibolmo Fixes #2164.
Changed value property setter was too strict with defaulting to an empty
string. Now Element.set('value') for falsey values depends on toString
of that object for setting the right value.

PASSED: IE6-9; FFx 3-5, 8; 10; Safari 5; Opera 11; Chrome latest
0b42256
@ibolmo ibolmo closed this in 0b42256
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.