• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

8. Dynamic Forms > 8.9. Disabling Form Controls

Disabling Form Controls

NN 6, IE 4

Problem

You want to temporarily lock down a form control to prevent user access to the control.

Solution

In IE 4 or later and NN 6 or later, form controls provide a Boolean disabled property that scripts can change at any time. Use any valid reference to the form control to set its disabled property to true:

document.myForm.myFirstTextBox.disabled = true;

To restore functionality to the control, set its disabled property to false:

document.myForm.myFirstTextBox.disabled = false;

A disabled form control generally displays a greyed-out appearance and does not permit user modification of the setting.

Discussion

Figure 8-2 shows the form from


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint