Archive for the ‘Geek Squeak’ Category

@Media Ajax…

Tuesday, November 20th, 2007

Those of you who read this blog will probably recall that I put off a round of IUI treatment to go to ‘Vanilla’ @Media back in June.

Yesterday was Day 1 of the AJAX flavour of @Media, and I will still have nightmares about the pickled carrots they served at the buffet lunch.

The talks were good, those by Derek Featherstone and Stuart Langridge were the highlights for me.

The day was, alas, bookended by some particularly horrid experiences, mainly on the theme of being 5 months pregnant with a bad back and legs, and being shoved and kicked on the Tube and glared at as i made my way down a FCC train carriage to my husband who had tried to keep a seat for his ‘imaginary pregnant wife’, he gave me his seat, but I did burst into tears due to the shear stress of the day, so I hope those people who thought that he’d just made it up to have a place for his bag are suitably mollified.

So I am spending today at home working and trying to recover mobility sufficiently to do my no less unpleasant in a different way commute to Cambridge tomorrow. And also regain my faith in humanity enough that I don’t go on a rampage through the office :-)
I will post something better/nicer about the talks I enjoyed at a later stage, but at the moment most of my brain power has dwindle, and I’m about able myself mugs of cocoa and think about intranets.

Label those inputs & jQuery textinputfeedback Plugin

Saturday, October 20th, 2007

Forms are notorious places for accessibility compliance to fall apart. If you religiously make sure that all your input fields, be they input tags, radio/check box or text aress have associated label tags then well done - but you are using the for attribute aren’t you?

If you are then you probably know why you are adding label tags and why you are linking them to their inputs by using the input’s id as the value for the for attribute.

If you don’t and that previous sentence made absolutely no sense whatsoever then you are missing an important part of making your site accessible.

Now, do bear in mind that with the advent of web2.0 and user-provided content yadda yadda, you want, and may encourage, your audience to interact with your site; this boils down to filling in and submitting a form of some kind.

Labeling is a pretty straight forward concept - you want people to know what information you expect/want in which fields. This becomes especially important if you are having some automatic process deal with the information - such as sending a confirmation email back to that person - doesn’t really work if they mistakenly put their email address in the wrong field; they might do it on purpose but we will assume not.

Now you might wonder why you need a specific label tag to do this - a bit of text in a strong tag before the field in question generally achieves the same effect.

Visually this may be the case.

For screen readers and other assistive technologies however you can’t make such an assumption.

By using the label tag with the for attribute you are creating a logical link between and input field and its label which screen readers understand and are able to relay to the user.

Also in terms of semantic markup and styling you are in fact doing yourself, and anyone else who might come cold to your code, a big favour.

Firstly you can see easily what is a label. You can style all your labels in one go. And regardless of whether you place your labels to one side or above their associated input fields, users relying on assistive technologies will know which inputs have which labels.

And now time for a bit of naming and shaming.

Who uses Facebook? I do, and I know a fair few usability and accessibility experts who do too.

And for a site that driven by people filling in forms with information about themselves, messages to friends, the whole shooting match; how does Facebook fair with labeling their forms?

Before I tell you, here’s something that might give you a clue.

Go to your ‘edit profile’ link and view source…

Yes, folks, they are using a table for laying out their form. Now I don’t think that’s tabular data, do you?

And for those labels? td with a class of…. wait for it it’s highly original….

label

At this point I must say that I felt like banging my head against the wall, but my husband was worried that this might have a bad effect on our unborn child. I am a bit worried about I am bringing a child into the world where people still use tables like idiots.

textinputfeedback Plugin
Now after all that I do have another little plugin with a long name to share. One drawback of text input fields, in particular those with a maximum length - the maxlength attribute - is that you can soon loose track of how many characters you have used, and I’m not sure that I’ve seen consistent labeling in terms of the number of characters that the field will accommodate.

The maxlength attribute should be specified especially when the value of the input field is to be inserted into a database, since unless you are doing some checking and either error reporting or slicing on the server side you are likely to cause your database to complain alot when you try to insert the data. It also helps protect against buffer over run type exploits. You might also want to check for dodgy SQL in the data to avoid something like this: http://xkcd.com/327/ . Your server-side lanuage of choice may delimit the SQL code for you but it helps to get in a good habit in case you have to use another language that isn’t quite so forgiving.

(My husband, the security expert, points out, very rightly that you should not assume that people will submit data to the handler via your form - but through some nefarious form of their own, so you should also sanity check and santise your inputs in your handler script. I will post up on security issues relating to form intercepts at a later time.)

This plugin will insert a span tag immediately after your input tags. If you have a maxlength specified it will show you number of character in the field and the total number, if maxlength doesn’t have a value or isn’t there it will just keep track of the number of characters in the field. The plugin attaches a keyup event to the inputs so that the count is updated after each keyup. The demo page lets you see this in action.

Remember though, users with JavaScript disabled will not have the benefit of seeing the feedback; however the form will still be usable - this is an instance of enhancing something that is perfectly functional and accessible in its vanilla state.
Code: jquery.textinputfeedback.js

Demo: http://www.theoddsock.com/jQuery/textinputtest.html

The following jQuery will select all inputs of type text. This is handy as it means you can attach the functionality to all your inputs with one line of code.
$(’input[type=”text”]’).textinputfeedback()

Now I’m off to update date this to also handle textareas….

jQuery - it rocks!

Tuesday, July 24th, 2007

I just know I’m going to act like a complete teenybopper when I go to @media AJAX in November… The reason? Because I’ve been hacking (albeit it very elegantly in an unobtrusive-Javascript way ala Jeremy Keith) with jQuery over the last few days to put together an interactive timeline. And instead of it leaving me as a shell of my former self I am hopped up on a coding enduced endorphine high like I haven’t been since I was at uni; coding Enigma machine  simulators in Java.

Of course, I am sure that I am not alone and certainly not the first to enthuse about jQuery.

I’ll be putting together a presentation/work/walk through of the timeline for work and then post a version here in case it might prove handy to someone else.

Geek Squeak - begin squeaking!

Friday, July 20th, 2007

For the last few weeks I’ve been trawling through CVs which has been a rather depression experience, I won’t say why in particular but in general I find that they don’t transmit to the reader any spark of enthusiasm for the area that I’d hope for. Perhaps I’ve just been reading the wrong CVs.

My own CV is very out of date and in complete -I simply haven’t gotten around to updating it when I moved over to using WordPress. I really hate having to prepare one as well since I really do want prospective employers to know that I have Grade 7 violin and had a life before uni and completing my journey to the geek-side.

Nor do CVs or interviews really give a taste of what a person is really like, their personality, sense of humor and other really important questions: FireFox or IE, Star Wars or Star Trek, TNG or DS9. I’m for DS9 as a perference but I’m alone on that one it seems, how they will react to seeing the new, rather - ok very - phallic water cooler…

So for my own benefit really, since I’m not sure who reads this blog other than my mother who, although she lost maths once letters appeared, has become a complete YouTube addict, I’ve decided to make sure I post on techy things that I’m working with at the moment or really excited about… Yes my live is that dull, I haven’t got any kids yet remember. These may be new to anyone who reads it, or it might illicit responses of ‘Duh and Seen it’ but no matter, it will help me keep track of what I’ve been doing with my life…

So then, what have I been up to recently then?

Well… my copy of Bullet-proof AJAX arrived earlier in the week, I started reading it, but ended up leaving it in the office this afternoon, poo! I do enjoy Jeremy Keith’s writing style, and I don’t think its all his editor, despite his forward, having heard him talk (@media07) he has a great sense of humor and it translates into his explanations whether they are live or on paper. I’m looking forward eagerly to @mediaAJAX.

However, book-(buying)-slut that I am I also ordered his book on DOM scripting which arrived today along with Transcending CSS, the latter I am hoping will help alleviate my website design block… Either way it looks very shiney.

Other than that my project for the weekend is to get a timeline thing working (

etc based) I’m using the progressive enhancement approach and then going to merge it with my plans for playing around with jQuery to tart it up. On my way home from the office tho I started wondering if I could encorporate it with microformats…..