473,396 Members | 1,990 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.

How to set textbox to readonly

hi!

I am using a datepicker from javascript i would like to store only the date from the datepicker into the textbox. Can any one suggest me how to use it. Please do not say go google i had gone through it but i am unable to find it.

Thank you,
Dec 19 '07 #1
4 1858
VijaySofist
107 100+
Hi!

If you not want directly to edit into the Text Box Try the following bolded words in the code given below

<input type=text value="Vijay" id="txt1" contenteditable=false />

All the Best

With Regards
Vijay. R
Dec 19 '07 #2
drhowarddrfine
7,435 Expert 4TB
There is no such thing as "contenteditable".

This is a javascript question so I'm moving it there.
Dec 19 '07 #3
Dasty
101 Expert 100+
Expand|Select|Wrap|Line Numbers
  1. <input type=text value="Vijay" id="txt1" readonly  />
in html

OR
Expand|Select|Wrap|Line Numbers
  1. document.getElementById('txt1').setAttribute('readonly','true');
in javascript
Dec 19 '07 #4
Actually you should use

<input type="text" readonly="readonly">

Or using js you can

Expand|Select|Wrap|Line Numbers
  1. <input type="text" onclick=" if (!this.readOnly) { this.readOnly = 'readOnly' } else { this.readOnly = '' } ">
  2.  
Dec 19 '07 #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...
8
by: tshad | last post by:
I cannot seem to get the asp:textbox to use classes. Style works fine. I am trying to set the textbox to act like a label in some instance so it doesn't have a border, readonly and the background...
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...
4
by: H-S | last post by:
Please help. This is a real puzzler! Originally posted on microsoft.public.dotnet.framework.windowsforms but no answer found! I have a read-only textBox which shows the results of a selection...
2
by: johnlim20088 | last post by:
Hi Someone please help me string typ; if (e.Row.RowType == DataControlRowType.DataRow) { typ = e.Row.Cells.Text;
6
by: Brandon McCombs | last post by:
Hello, I have a Form that contains some configuration information. One of the settings is for SSL. There is a checkbox that I want to check to make 2 textboxes un-editable so that a user can...
10
by: moondaddy | last post by:
I have a textbox on a webform and based on certain conditions I wanted to prevent a user from editing its text. I dont like the look of the texbox when its disabled and was wondering if there is a...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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,...

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.