|
-
July 26th, 2005, 12:41 PM
#1
dynamically adding a read only attribute in a JSP tag
Hey all
I am new to JSP and I would like to know (or if you guys could point me in a direction) on adding attributes to a tag dynamically with JSP
for example
I have this textinput field that takes in text
I just want to lock the textinput field when the user enters in "LOCKED", so in other words
when the textinput field gets the value of "LOCKED", the textinput field should be readonly or disabled.
Can anybody help me?
thanks!
-
July 26th, 2005, 01:17 PM
#2
Re: dynamically adding a read only attribute in a JSP tag
JavaScript, or JavaServerPages? They are totally different. If you want to use JavaScript, you can use something like:
Code:
<input type="text" id="txt" onkeyup="if(this.value.toUpperCase()=='LOCKED') this.setAttribute('readonly','readonly')">
If you want only LOCKED and not LOcKeD, then remove the blue text in the code
*9-11-01* Never Forget; Never Forgive; Never Relent!
"If we ever forget that we're one nation under God, then we will be a nation gone under." - Ronald Reagan
-
July 26th, 2005, 05:56 PM
#3
Re: dynamically adding a read only attribute in a JSP tag
hey Dr.Script
I was actually referring to JSP. Could I incorporate the java script in JSP?
thanks for the reply
-
July 26th, 2005, 06:06 PM
#4
Re: dynamically adding a read only attribute in a JSP tag
JSP is server coding. It cannot handle what you need, as far as I am aware. What you need is a client side language, which is what JavaScript is for. JSP could only handle it, for example (as far as I know), iuf after every letter the field is submitted with its value, and if the value is locked, then it could add the readonly attribute.
The code I provied will work in a .jsp page. However, since it is not JSP code, it can work equally as well on a .php, .html, .asp, etc ...
*9-11-01* Never Forget; Never Forgive; Never Relent!
"If we ever forget that we're one nation under God, then we will be a nation gone under." - Ronald Reagan
-
July 27th, 2005, 11:12 AM
#5
Re: dynamically adding a read only attribute in a JSP tag
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|