hi all,

I want to disable some of text fields and several buttons on my webpage when click on "Edit" button.. I am using images as buttons.

document.getElementById("textFieldID").disabled = true;

document.getElementById("imageID").disabled = true;

but on clicking the Edit button, still the other buttons(images) does not disabled. those are acting (those are properly working on click)..why is that...?

And on click edit button the text field is successfully disabled but when the page is refreshed, that field still disabled, but a combo box on the same page, is properly working (on refresh it enables again) ...so why is that...?

I can enable it by writing a javascript on page load.. but I want to know the reason for that..? Is there any special effect for text fields..?

janaka priyadarshan

9 Years
Discussion Span
Last Post by MattEvans

It perhaps depends on what browser you use... I know for sure that Firefox remembers script - based states, so refreshing doesn't undo the effect of scripting.

Opera does something similar, but it doesn't seem to override settings in the HTML (unfortunately, I don't think it's possible to force the enable state with HTML, I might be wrong, and you might be able to do it with CSS, but it might not be effective)

IE(6) doesn't remember script states, so the page should always revert to the version unmodified by script on refresh. If it doesn't work like that, it's not well documented how it does work.

Putting an onload handler to check things are enabled is a good bet, just to ensure that things are going to be the same across browsers.

I don't know why it's only the textarea/field that's persistantly disabled, are you sure the coding relevant to both of them (textarea/field + combobox) is equivalent? There should be a reliable 'standard' of sorts within whatever browser on how it deals with such things..

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.