Skip to content

Commit

Permalink
Fixed bug in checkbox where a string of "true" is passed and compared…
Browse files Browse the repository at this point in the history
… to the default of a type boolean, hence always returning false. Added test to convert type if needed.
  • Loading branch information
adam brin authored and ericabouaf committed Feb 14, 2010
1 parent 066e2c6 commit 62cb147
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion js/fields/CheckBox.js
Expand Up @@ -100,7 +100,8 @@ lang.extend(inputEx.CheckBox, inputEx.Field, {
* @param {boolean} [sendUpdatedEvt] (optional) Wether this setValue should fire the updatedEvt or not (default is true, pass false to NOT send the event)
*/
setValue: function(value, sendUpdatedEvt) {
if (value===this.checkedValue) {
if (value===this.checkedValue || (typeof(value) == 'string' && typeof(this.checkedValue) == 'boolean' &&
Boolean(value) === this.checkedValue)) {
this.hiddenEl.value = this.checkedValue;

// check checkbox (all browsers)
Expand Down

0 comments on commit 62cb147

Please sign in to comment.