I've updated the CRIR (Checkbox and Radio Input Replacement) script. Based on a tip left by Adam Burmister on my last blog post, The updates add keyboard support to the script. Basically instead of hiding the input element I just move it off the screen. This allows you to still use your keyboard to tab to each element and use your spacebar to check / uncheck checkboxes, and you can use the up and down arrow keys to control groups of radio buttons. I've also fixed a few minor bugs that we're brought to my attention.
This was the one major flaw with the CRIR script and I'm glad to have it fixed. Be sure to go download the lastest updates.
Thanks again for the tip Adam.
I caught the link to this site from the Stylegala public news section and I have to say that I think your script is very interesting. One thing I noticed was when you use the keyboard to access the different form inputs, there is no indicator as to which input you’re currently focusing on. I haven’t looked at your code or anything so I can’t really offer any advice, but, I’m sure it would be a welcome addition to the feature set if the user could know what form input currently had the focus.
Great work though.
Great script – thanks!! Except, I am having trouble with select elements in my form. I’ve found that if there is a select drop down, I get an error on line 31 in the javascript file. The error message is
inputElement.getAttributeNode(“type”) has no properties
if I remove the select element from the form, it works fine…. any ideas??
@Matt
Thanks for the heads up, I’ve fixed the bug and you should download the latest update.
You should set example with checkbox disabled. :)
Great script-just what I was looking for! It seems that in Safari 2.0.3, the form looks like it has loaded correctly, but will not change onclick. I’m horrible at Javascript, any ideas? Thanks!
very nice and clean script….thumbs up! I just run into the same safari problem…I wish I’d know enough js and about safari to solve it by myself…
Chris,
Very cool script – I was getting tired of looking at those tired checkboxes and radio buttons. There was one thing though… When the checkboxes are changed on the client side, there was no way to change the images. I added this to your class so that when I change the checked value on the client side I can call this to refresh the checked or unchecked items. It’s all you!
RefreshLabels: function()
{
var arrLabels = document.getElementsByTagName(‘label’);
for (var i=0; i
Excellent script.
One thing: Like the bug related to SELECT items, I believe crir.js also doesn’t like TEXTAREA items. If you have one on your form, you’ll get the JavaScript error about the object having no properties. (Happened to me in FF2 and IE7.)
To fix it, I just added another exception:
< else if (inputElement.nodeName != 'SELECT' && inputElement.getAttributeNode('type').value 'radio') { // this so even if a radio is not hidden but belongs to a group of hidden radios it will still work.
> else if (inputElement.nodeName != 'SELECT' && inputElement.nodeName != 'TEXTAREA' && inputElement.getAttributeNode('type').value ‘radio’) { // this so even if a radio is not hidden but belongs to a group of hidden radios it will still work.
Thought I’d mention it in case others run into the problem!
Again, thanks! Nice stuff.