View Full Version : Make a form element read only only when. . .

12-31-2003, 07:46 PM
Hello -

I know I can make a field permenently read only with -


but how can I make a form element read only when a certain condition is met? ie. if one field is checked or filled out make the other field read only?


12-31-2003, 08:27 PM
Ha! Staring blankley at your post really does help.

function readOnly(obj)

<input type="text" id="txt1" onfocus="readOnly('txt1')">

This will work - but is there not a way that I could set this up and just call the function like this: readOnly(this); So that It knows I am refering to the focused object? As I have it now by passing "this" - "this" would refer to the function not the object correct?

I think I need to create an object or somthing but I'm just not there yet.

Thanks Again,

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum