473,396 Members | 2,030 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

make textbox readonly

how to make the textbox uneditable when we click a button.
I want to make the textbox uneditable when we click a button.plz help me.
thanks in advance.
Mar 17 '08 #1
4 3543
gits
5,390 Expert Mod 4TB
hi ...

refer to your textbox node with getElemenById('the_textbox_id') and set the readonly property to true:

Expand|Select|Wrap|Line Numbers
  1. node_ref.readonly = true;
put that in a function and call it onclick of the button.

kind regards
Mar 17 '08 #2
vee10
141 100+
hi,
Expand|Select|Wrap|Line Numbers
  1. document.getElementById("Textboxid").disabled = true;
or else

Expand|Select|Wrap|Line Numbers
  1. formname.texboxname.disabled = true;
  2.  
write this code in onclick event of the button

how to make the textbox uneditable when we click a button.
I want to make the textbox uneditable when we click a button.plz help me.
thanks in advance.
Mar 17 '08 #3
gits
5,390 Expert Mod 4TB
one note: the text in readonly boxes may be selected and so copied in disabled ones you cannot do that .... but in both cases tha box is not editable :)

kind regards
Mar 17 '08 #4
acoder
16,027 Expert Mod 8TB
One other major difference is that disabled field values are not sent when the form is submitted whereas read-only ones are.
Mar 18 '08 #5

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

Similar topics

5
by: pv_kannan | last post by:
Hello, I am stuck with a problem trying to mimic the behavior of a Windows Forms Readonly textbox in HMTL/ASP.NET. Basically, I would like the text to be readonly and overflow the textbox...
10
by: GP | last post by:
Is it possible to iterate through all the controls collection and make the textboxes alone as read only.I don't see a readonly property for the Control.Can some one help me in this context? I...
3
by: Angela Chen | last post by:
Hi, I have a readOnly textbox. I want to be able to double click it to make it editable? How to implement it?\ Thanks a lot
4
by: NH | last post by:
Hi, I just cannot get this to work. I want to make a cell editable in a datagrid only if the value of another cell is something specific. I am able to capture the value of the other cell via the...
3
by: Lyners | last post by:
I am having a hard time with this one, and I thought it would be easy. I have a datagrid in which I have textboxs for users to enter data. One of the fields in the database behind the datagrid...
2
by: Eric | last post by:
I have a textbox on a form that is populated from the database when the form loads. When I check textbox.Text when the user clicks my submit button, the value is always what it was when the form...
9
by: ShaneFowlkes | last post by:
Hey guys... I have a form that asks for several dates. I tried using asp calendar controls to set values of the date textboxes which were readonly. I found this annoying since each time I...
1
by: Thierry | last post by:
Hi, We are currently upgrading our .Net web apps from framework 1.1 to 2.0 Everything is going quite smoothly except a bug with textbox value not rendered when having propery readonly=true on the...
1
by: dilipkp | last post by:
hi all, actually i want to make a textbox readonly... dynamically i want to change the textbox readonly and editable.. so is there any way i can specify in the style, this readonly property, and...
2
by: johnlim20088 | last post by:
Hi Someone please help me string typ; if (e.Row.RowType == DataControlRowType.DataRow) { typ = e.Row.Cells.Text;
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
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...

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.