It's not a secret anymore!*
The moose likes HTML, CSS and JavaScript and the fly likes disable text box Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "disable text box" Watch "disable text box" New topic
Author

disable text box

priya pillai
Ranch Hand

Joined: Sep 12, 2007
Posts: 57
Hi friends

I want to disable my text box using java script.

Here "a" is the line number where change dynamically

var remarks="remarks"+a
var remarks_1=document.getElementById(remarks)

document.f_update.remarks_1.disabled== "true";

f_update is the form name.

It is not working..
thanks in advance
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
== is a comparison

Eric
priya pillai
Ranch Hand

Joined: Sep 12, 2007
Posts: 57
I used

document.f.remarks_1.disabled = true;

Still not working...

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Perhaps if you change "f.remarks_1" back to "f_update.remarks_1"...
priya pillai
Ranch Hand

Joined: Sep 12, 2007
Posts: 57
I changed the form name also to f that is why


stil not working

out.println("<input type=\"text\" size = \"14\" name=\"remarks" + SNo+ "\" value=\"" + remarks+ "\">");


where SNo is the serial number which change
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Why would you find it by id than try to look it up via the form?

All you would need to do is

remarks_1.disabled=true;

Eric
 
 
subject: disable text box
 
Similar Threads
&nbsp; html code in PostgreSQL table
Problem in formatting of what is displayed in Outlook's opened window
Dependent select list query
how to disable space bar key in java script
disable combobox with the help of javascript