473,473 Members | 1,954 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Disable Form Elements

24 New Member
How do you disable/enable form elements with a check box. Like when it is check you cannot add anything to say name field?
Nov 9 '07 #1
4 2616
missinglinq
3,532 Recognized Expert Specialist
To immediately lock/unlock the name field when the check box is checked/unchecked
Expand|Select|Wrap|Line Numbers
  1. Private Sub YourCheckBox_Click()
  2.  If YourCheckBox Then
  3.    YourNameField.Locked = True
  4.  Else
  5.    YourNameField.Locked = False
  6.  End If
  7. End Sub
  8.  
To maintain locked/unlocked status when moving from record to record
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2. If YourCheckBox Then
  3.    YourNameField.Locked = True
  4.  Else
  5.    YourNameField.Locked = False
  6.  End If
  7. End Sub
Welcome to TheScripts!

Linq ;0)>
Nov 9 '07 #2
clickingwires
24 New Member
To immediately lock/unlock the name field when the check box is checked/unchecked
Expand|Select|Wrap|Line Numbers
  1. Private Sub YourCheckBox_Click()
  2.  If YourCheckBox Then
  3.    YourNameField.Locked = True
  4.  Else
  5.    YourNameField.Locked = False
  6.  End If
  7. End Sub
  8.  
To maintain locked/unlocked status when moving from record to record
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2. If YourCheckBox Then
  3.    YourNameField.Locked = True
  4.  Else
  5.    YourNameField.Locked = False
  6.  End If
  7. End Sub
Welcome to TheScripts!

Linq ;0)>
Ok... works but is there anyway to visually gray it out?
Nov 9 '07 #3
clickingwires
24 New Member
Ok... works but is there anyway to visually gray it out?
Figured it out... I just changed Locked to Enable and switch the True/False statements... Thank you!
Nov 9 '07 #4
missinglinq
3,532 Recognized Expert Specialist
Glad we could help!

Linq ;0)>
Nov 10 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Bob Bedford | last post by:
I've this code: function checkdate(FormSubmit){ alert(document.getElementById('Mois').value); if(eval(document.getElementById('Mois'))>0 && eval(document.getElementById('Annee'))>0){...
30
by: Blnukem | last post by:
Hi All I'm new to javascript and was wondering if someone can help me with this I want to disable my second and third drop-box if the first one is selected to "Closed" I think I'm close but just...
5
by: Bob Bedford | last post by:
I create checkboxes using datas from a database (with PHP). I store all values in an array, as I must pass this value like a Form value. Now, in some cases, when a checkbox is selected, I must...
3
by: Mark Hannon | last post by:
Does "document.formName.elementName.disable" work on hidden form text elements? I have a form with some input fields that are associated with some hidden text fields and I would like to disable all...
12
by: Forti2ude | last post by:
Hello, I have a simple form... <form> <select name="foo" multiple> <option value="1">one</option> <option value="2">two</option> <option value="3">three</option> </select>
3
by: Bart Van der Donck | last post by:
Hello, I have a dynamic page of which I don't know how many forms will be on it, neither which and how many elements will be in each form. I use the following java script to disable all...
4
by: Chris | last post by:
I have an asp.net page say page1.aspx. The form in html code is <form id = "Form1"> And i want to disable all the fields of the form after some code steps. I had created a javascript funct: ...
8
by: prado | last post by:
I want to disable a table with javascript. In this table i have 'n' record and each record has 3 buttons. If you click a button does an action. I want to disable the all table. is there any way...
6
by: Mike | last post by:
I have a form that contains 240 "products". Each Product has a TR. Each TR contains a Yes and No radio button and a Product-Qty text input. A situation exists where I have to go through all the...
4
by: SteveKlett | last post by:
I have a subset of form items that I need to perform different operations on (enable/disable, clear values, change style, etc) rather than hard code the IDs or names I would like to recursively...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.