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

August 1, 2007

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. .

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


RSS iNaturalist Observations

Recent Comments

Kristina Rosenbaum on Computer Literacy Program …
scienceguy288 on Computer Literacy Program …
gaugeyagee on Computer Literacy Program …
Dave on Computer Literacy Program …
gasstationdave on Computer Literacy Program …

Flickr Photos

Computer Literacy - Software - Khalif, TD and Jacal Laugh at Their Images

Computer Literacy - Software - Editing Images with GIMP

Computer Literacy - Software - Raised Hand to OS Question

Computer Literacy - Software - Terrace and Steve Smith

Computer Literacy - Software - OS Video

More Photos

Networks

Nature Blog Network

Carnivals/Swarms

Festival of the Trees

Blogroll

Archives

Meta