Skip to content
This repository has been archived by the owner on Nov 5, 2020. It is now read-only.

choiceFields render as text field in IE8 #10

Open
jindustry opened this issue Nov 15, 2011 · 1 comment
Open

choiceFields render as text field in IE8 #10

jindustry opened this issue Nov 15, 2011 · 1 comment

Comments

@jindustry
Copy link

When rendered from script, choiceFields (both radio buttons and checkboxes) render fine in firefox but render as text inputs in IE8. I will do a little more digging to see if I can see the issue.

Looks like SubmitButton and ResetButton field types also render as input boxes.

@jindustry
Copy link
Author

The problem seems to be that you can't change a input type in IE through javascript. So the problem is in Y.FormField._syncFieldNode where you try to change the "type" attribute of an input node.

    _syncFieldNode: function() {
        var nodeType = this.INPUT_TYPE || this.name.split('-')[0];
        if (!nodeType) {
            return;
        }
        this._fieldNode.setAttrs({
            name: this.get('name'),
            type: nodeType,  // this never changes in IE
            id: this.get('id') + Y.FormField.FIELD_ID_SUFFIX,
            value: this.get('value')
        });

        this._fieldNode.setAttribute('tabindex', Y.FormField.tabIndex);
        Y.FormField.tabIndex++;
    },

The options seem to be:

  1. create an input with the correct type initially.
  2. In _syncFieldNode, create a completely new node and replace the original if the type is not "text" like this example: http://www.universalwebservices.net/web-programming-resources/javascript/change-input-element-type-using-javascript

Note that this problem occurs for any field in IE that is an input node with a type other than text (e.g. inputs with types checkbox, radio, submit and reset). Select and textareas render ok in IE.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants