Google analytics code

Monday, August 26, 2013

PHP: Zend Studio 10 Sale

Zend Studio is a fantastic PHP dev tool. I've used it for years and they keep making it better. It's built on top of Eclipse so it can be used as a plugin. I have it set up this way so I can work on my PHP API and Android client in the same tool.

It's on sale now for a limited time. Not sure when the sale ends, but it's totally worth picking up.

Friday, August 2, 2013

Javascript / IE8 : file fields created by javascript allows text entry

I ran into an issue in IE8 while creating file fields in javascript for a form. The newly created file field allowed text entry. It didn't matter if I used jQuery or created the field with createElement.


$
var fileField = $('',{
            'id': 'picker-2',
            'type': 'file'});

            $('#fields').append(fileField);

When the field was placed on the screen it allowed users to enter text. This isn't a huge issue, but this shouldn't happen. It doesn't happen when you create the file field through HTML. You can see an example here.

The solution to this problem is cloning the newly created field before appending it to the DOM.


var fileField = $('',{
            'id': 'picker-2',
            'type': 'file'});

$('#fields').append(fileField.clone());
            
            

This will make it behave like a normal file field. You can see an example here.