Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 899
  • Last Modified:

How do i make a textbox value disable + cannot edit_URGENT


Hi,
  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?

Thanks
   
0
Jasbir21
Asked:
Jasbir21
  • 2
  • 2
  • 2
  • +1
2 Solutions
 
apparitionCommented:
put a readonly in your text box
<input type="text" name="username" value=<%=username%> size=20  readonly/>
0
 
VincentPugliaCommented:
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() />

Vinny
0
 
jaysolomonCommented:
or

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

and then just write there name on the page

<%
     response.write(request.form("username"))
%>
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Jasbir21Author Commented:
Hi,
  when i tried i got the error :
C:\apache\tomcat\work\Catalina\localhost\jsp-examples\org\apache\jsp\jsp2\jas_jsp.java:331: cannot resolve symbol
symbol  : method form (java.lang.String)
location: interface javax.servlet.http.HttpServletRequest
     response.write(request.form("username"));
                           ^
I can't figure out why,thanks
0
 
VincentPugliaCommented:
if you mean jay's last example -- that is not javascript; it is asp/vbscript

Vinny
0
 
jaysolomonCommented:
sorry i thought it was asp

what is it jsp?

if so i no notta about it

0
 
Jasbir21Author Commented:
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
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now