How do i make a textbox value disable + cannot edit_URGENT

Posted on 2003-10-29
Last Modified: 2010-04-09

  LEts say i have a texbox:

<input type="text" name="username" value=<%=username%> size=20 />

How do i make disable so that the user cannot change that value.

Second question:
  LEts 's say a user gets a value from the pop-up calender, or list, the textbox, where the value is put in cannot be edited by the user.
How do i do that?

Question by:Jasbir21
  • 2
  • 2
  • 2
  • +1

Assisted Solution

apparition earned 20 total points
ID: 9642780
put a readonly in your text box
<input type="text" name="username" value=<%=username%> size=20  readonly/>
LVL 15

Accepted Solution

VincentPuglia earned 20 total points
ID: 9643045
two other options:

<input type="text" name="username" value=<%=username%> size=20  disabled = 'disabled' />

or...crossBrowser, crossVersion compatible:

<input type="text" name="username" value=<%=username%> size=20  onfocus=this.blur() />

LVL 16

Expert Comment

ID: 9644071

<input type="hidden" name="username" value="<%= username%> />

and then just write there name on the page

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.


Author Comment

ID: 9647124
  when i tried i got the error :
C:\apache\tomcat\work\Catalina\localhost\jsp-examples\org\apache\jsp\jsp2\ cannot resolve symbol
symbol  : method form (java.lang.String)
location: interface javax.servlet.http.HttpServletRequest
I can't figure out why,thanks
LVL 15

Expert Comment

ID: 9647144
if you mean jay's last example -- that is not javascript; it is asp/vbscript

LVL 16

Expert Comment

ID: 9647728
sorry i thought it was asp

what is it jsp?

if so i no notta about it


Author Comment

ID: 9648298
oh, jsp is java servlet pages, i am just beginning to learn that ,

Thanks so much for the help, i would be spliting points since both answers were very very helpful. I guess, its' an A with both accepted answers.

Thanks and God bless

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question