Disable/Lock Text Input Form Fields

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved
Reply

Join Date: Sep 2007
Posts: 1
Reputation: LOVE4CODE is an unknown quantity at this point 
Solved Threads: 0
LOVE4CODE LOVE4CODE is offline Offline
Newbie Poster

Disable/Lock Text Input Form Fields

 
0
  #1
Sep 29th, 2007
I've created a admin center, that has two seperate login permissions. Admin which can edit listings, etc... and Viewer which can only view listings, and edit 1 or 2 of the listings details and not all of them like the admin.

I've seen web-sites where certain text input fields are sort of Grayed out, not allowing for user to type, click in or change anything in that field. Sort of like the html text input field has been or is disabled...

My Question: How can I get certain html text input fields to appear disabled, and the text that's inside un-editable or unchange-able?

Thank you much
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 7,581
Reputation: ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of 
Solved Threads: 461
Super Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Failure as a human

Re: Disable/Lock Text Input Form Fields

 
0
  #2
Sep 29th, 2007
> How can I get certain html text input fields to appear disabled, and the text that's inside
> un-editable or unchange-able?
You have got to realize that 'disabled' doesn't mean or equate to 'readonly'. Both these properties disallow the user from editing the entered text but the real difference comes when you try retrieving the form element values at the server. If the element is marked with the property 'disabled', the form element value won't be submitted to the server while a form elements' value marked 'readonly' will be.

<input type="text" name="txtName" id="txtName" readonly="readonly" />
<input type="text" name="txtName" id="txtName" disabled="disabled" />
I don't accept change; I don't deserve to live.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 1
Reputation: Zion_Lion is an unknown quantity at this point 
Solved Threads: 1
Zion_Lion Zion_Lion is offline Offline
Newbie Poster

Re: Disable/Lock Text Input Form Fields

 
0
  #3
Jul 30th, 2009
Thank you ~s.o.s~
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 1
Reputation: benjiei is an unknown quantity at this point 
Solved Threads: 1
benjiei benjiei is offline Offline
Newbie Poster

Re: Disable/Lock Text Input Form Fields

 
0
  #4
Jul 30th, 2009
Originally Posted by ~s.o.s~ View Post
> How can I get certain html text input fields to appear disabled, and the text that's inside
> un-editable or unchange-able?
You have got to realize that 'disabled' doesn't mean or equate to 'readonly'. Both these properties disallow the user from editing the entered text but the real difference comes when you try retrieving the form element values at the server. If the element is marked with the property 'disabled', the form element value won't be submitted to the server while a form elements' value marked 'readonly' will be.

<input type="text" name="txtName" id="txtName" readonly="readonly" />
<input type="text" name="txtName" id="txtName" disabled="disabled" />

Thanks you very much...im newbies in web programming...God bless
In GOD we trust!
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC