0

Hi Can somebody help me explain moo eip, its kinda acting weird in regards am not able to on click change field into type file.

It works good for text, password even textarea

this is how I declare input type text

var editField = new Element('input', {
    'type': 'text',
    'name': 'fieldValue',
    'class': this.options.styleInput
});

Using Mootool 1.2

Moo EIp version 0.1.1

Any help will be apprectiated

Dimitar Christoff
  • 25,905
  • 8
  • 47
  • 66
Sylvia
  • 1

1 Answers1

0

no idea what MooElp is - you should post a link as nobody has time to look things up.

http://jsfiddle.net/dimitar/dsujK/

var editField = new Element('input', {
    'type': 'text',
    'name': 'fieldValue',
    'class': "foo",
    "value": "c:/autoexec.bat"
}).inject(document.body);

(function() {
    editField.set("type", "file");
}).delay(2000);

this works in FireFox 4 - but does not work in chrome 13 or IE 8

I believe it's a security measure that prevents you from making a regular input, setting a value, converting to a file type and then submitting the form - otherwise you'd be able to steal any file on your visitors' PCs - you should search stack overflow before you post. change type of input field with jQuery explains the problem.

Firefox 4 deals with it by cleaning the value first. Chrome drops prop change silently and IE throws an exception.

make your input with type file from the start or replace the input with a new one, rather than setting the type property.

Community
  • 1
  • 1
Dimitar Christoff
  • 25,905
  • 8
  • 47
  • 66