File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to make select list uneditable

 
srinivas sv
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
helo java ranchies,
if some action happens i don't want the user to change the element from the list box, at the same time i want this value to be passed with the form, for this reason i can't disable the list. Is there any function in javascript which makes the list uneditable.
thanx in advance
 
jyothsna kumari
Ranch Hand
Posts: 108
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
As far as i know one cannot edit the data in the list box or combo box.So there is no question in editing the data.
If you are using textbox or textarea then you can do that by specifying the input field as readonly.Something like this,
<input readonly value="text">
In this way you can make the field uneditable.

Jyothsna
 
srinivas sv
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks jyothsna for ur reply,
editable in the sense, the user selecting some other value from the list box
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can do couple things you can do,
One, you can use hidden elements and pass the information to them. Then you can disable the dropdown and be able to pass the information from them.
Second, you can have a function that will always set the item to the selected item that you want when the list is changed.
Third, you can remove all of the other items from the dropdown so there are no other choices to pick from.
Eric
 
srinivas sv
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank u very much eric,
is there any single function in javascript using which i can do this task
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what one would you want to see 1,2,or 3?
 
srinivas sv
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
once again thank u eric
i know the three ways of implementation, but is there any short cut,
example if i want to disable a form i use only a single function like formName.controlName.disable in the same way is there any single function which makes the select list read only.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try doing something like this
<form name="Blah" onsubmit="document.Blah.Test.disabled = false;">
<select name="Test" disabled>
 
srinivas sv
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank u very very much eric
it is working!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic