Ajax.InPlaceEditor auto load textarea instead of singleline - Firefox only

Another interesting discovery in the new prototype (1.6.1) & scriptaculous (1.8.3).

// Forces a textarea
<div id="MakeThisAnInPlaceEditor">
Just a bit of text
</div>

// Makes a single line item
<div id="MakeThisAnInPlaceEditor">Just a bit of text</div>
More info here http://yazmedia.com/sandbox/inplaceeditor.php

Permalink | Comments | May 25th, 2010 at 4:21 pm | 2 months ago
Tags: tech

[tech] tinymce + IE + IE Developer Tools = FAIL

Seems like IE doesn’t recognize the cursor on the textbox, so it doesn’t let you click if the textbox is empty.

Realized there was nothing wrong with tinymce or the javascript or the browser. Until I restarted the computer, started the browser without developer tools and realized: it worked all along.

3 wasted hours.

Permalink | Comments | May 19th, 2010 at 10:44 am | 2 months ago
Tags: tech

[tech] prototype & scriptaculous error: InPlaceEditor cancel control button -no good.

 new Ajax.InPlaceEditor(node, 'items.aspx', {
	cancelControl: 'button'
  });
Doesn’t work. Has to be link.

Source

ps: maybe i should create a tech blog. should i?

Permalink | Comments | May 14th, 2010 at 12:37 pm | 2 months ago
Tags: tech

Prototype 1.5 to 1.6 upgrade nightmare.

The issue: in prototype 1.5, there are some Ajax.Request calls that return onComplete, the response, and then a second variable passed through with json from php. Prototype 1.5 handled this perfectly fine.

But on the new prototype (1.6.1), Ajax.Request doesn’t handle that second variable. So the there are some chunks of code not executing because the variable is null.

This has taken me 2 days to figure out. Two whole days of researching, reading random people’s code, reading documentation, and when none of those panned out, reading the prototype file side by side to find what changed.

So, on to the practical example of what happened.

For prototype 1.5..

// In the php file that handles the ajax request

if( $_POST['ajax_request'] ) {
        $arrSomeStuff['name'] = "John Smith";
        $arrSomeStuff['city'] = "Toronto";
        echo json_encode( $arrSomeStuff );
}

//and the javascript request: 

new Ajax.Request('some_url.php', {
       parameters  : { 'ajax_request' = 1 },
       onComplete: function(response, arrSomeStuff){
               $('name_div').update(arrSomeStuff.name);
       },
       onFailure: function(response){
               // handle errors
       }
});
// assumes all the other defauls from Ajax.Options

The above code, processed just fine… until Prototype 1.6, where you can’t do that because the second parameter is the response.headerJSON. Something completely unnecessarily for my use. I need it to be the response.responseJSON option!

So if you want to get this to work with 1.6, you have to send along the right header in the php file.. otherwise javascript will read responseJSON as null

// NEW: send the content type 
header('Content-type: application/json');
echo json_encode( $arrSomeStuff );


// And the javascript request has to be modified like so: 
onComplete: function(response){
	var arrSiteVariable = response.responseJSON;
	// do whatever
}
There is another method of course, you could just forget about sending the json header, and parse the response.responseText string, which contains everything sent back from the server. (This might be a good thing because responseJSON only works for “small ammounts of text”, the limit is not specified. So trial and error friends)

The reason for this change? Well, the Ajax class now wraps xmlHttpRequest in this: Ajax.Response class/object/whatever thing. For more info: http://www.prototypejs.org/api/ajax/response

Now if you excuse me I have to go shoot myself, as there are about 20 or so Ajax.Request per javascript files, and there are about 50ish files.

Permalink | Comments | May 3rd, 2010 at 4:06 pm | 2 months ago

Google Maps loads into the dom, doesn’t display

Its because I had a z-index:-1 on the div that the maps get loaded. Changed it to 1, 2, 3, anything positive, and it started working.

Random changes like that to the google maps api over the weekend, suck.

Permalink | Comments | May 3rd, 2010 at 11:16 am | 2 months ago
Tags: tech
Permalink | Comments | April 5th, 2010 at 10:48 am | 3 months ago
Tags: tech fonts design

You know the real problem with frameworks? They demo too well. Someone shows you their favourite framework and demonstrates how you can build 50% of your application in half an hour! Great! That other 50% can’t be hard, can it? But it turns out that what looked like 50% is actually 5%, and filling in the other 95% gets exponentially more difficult as you approach the 100% mark. Frameworks are great for building toys, and that fools us — again and again — into assuming they’re good for building products.


Mike Taylor via What happened to programming redux
Permalink | Comments | March 9th, 2010 at 4:48 pm | 4 months ago

I dont care if it loses 90% of visitors, we cant have a skip on the website intro, we paid a lot of money for that and everybody has to see it.


(via clientsfromhell)
Permalink | Comments | January 27th, 2010 at 4:32 pm | 6 months ago
Permalink | Comments | January 12th, 2010 at 11:04 am | 6 months ago
Tags: tech
  • First photo: Rogers’ plans.

    Second photo: Telus’ plans.

    Rogers just lists all their plans on one page. But it doesn’t let you click through for more information! So I’m looking at the Data Browsing Plans, and I can’t figure out if they include voice or not. I looked at the MyFav5 options, and also it doesn’t tell me if I have to mix and match with something else. The page simply lists everything, doesn’t tell you what to do with it, except “compare plans” with each other.

    The Telus’ list, I don’t even have to explain that one. It just works.

    This is the 2nd redesign for Rogers this year. This one is a bit less cluttered than the last at least. But they fail at organizing important data, also when searching for phones you get this ‘refine results by’ column on the left that is incredibly useless; though it works a bit better on the programming channels option. Oh and I don’t even want to start on their “Page Not Found’ errors, they come up inadvertently every couple of minutes when browsing around… quite disruptive.

    They’re one of THREE telcom companies here, must they fuck things up so badly?

  • Permalink | Comments | August 10th, 2009 at 12:12 pm | 11 months ago
    Tags: design tech