Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Locking value in text field

Status
Not open for further replies.

lcky

Programmer
Sep 29, 2005
30
0
0
GB
Hi

I have a asp form, where user fill the values in the text fields. I have two fields, where I input default value, when user open this form. On submission of this form, This default values is passed to next stage. I would like to lock this fields, so that user can't change or delete this field value.

Is there any way I can lock this field in a asp page.
Please can you help me and provide a script.



 
This is actually HTML. You set the attribute of the input tag to READONLY.
Code:
<input type="text" name="txtDefault" value="Default" [COLOR=red]readonly[/color]>

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 
<input type="text" name="txtDefault" value="Default" [red]DISABLED[/red]>

-DNG
 
Either should work, the only difference is that the disabled attribute will grey out the textbox.

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 
unless my memory is going disabled will not pass the value through the form collection while readonly will. In your case from described Chopstik's method is the one you want.


General FAQ faq333-2924
5 steps to asking a question faq333-3811
 
yes onpnt, you are correct...the disabled form fields will not be posted back to the server...i was just providing another way of locking the textbox...

-DNG
 
Thanks for the clarification, onpnt. I have to admit I had forgotten that... [thumbsup]

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 
I would have forgotten as well if it wasn't for Tarwn beating it into my memory ;-)


General FAQ faq333-2924
5 steps to asking a question faq333-3811
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top