JavaScript Duh Moment of the Day – 8/1/2007

August 1, 2007 at 6:12 pm Leave a comment

When, oh when, will I remember that other form fields don’t enforce the readOnly attribute like text fields do in JavaScript?  I’ve done this before with a list field.  I’ve done it before with checkboxes.  I think I’ve even fallen victim with radio buttons.  And yet, everytime I want to dynamically lock down a field, I forge straight down that path:

document.FormName.DropDownList1.readOnly = true;

Grr.  As soon as I pull up the form and see the editable fields, I know exactly what the issue is.  Nonetheless, each time I do it, my frustration with this particular forgetfulness compounds.  By golly, one day I will get this right the first time!

P.S. In case you are wondering, you can disable the field (at least for IE 6, IE 7 and FireFox 2.0.0.6):

document.FormName.DropDownList1.disabled=true;

Entry filed under: JavaScript, Web Development.

“Oh Gawd, It *is* a Blog Post” links for 2007-08-02

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


Flickr Photos

3D Printed Products

Tweets


%d bloggers like this: