943,708 Members | Top Members by Rank

Ad:
Sep 29th, 2007
-1

Disable/Lock Text Input Form Fields

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
LOVE4CODE is offline Offline
1 posts
since Sep 2007
Sep 29th, 2007
0

Re: Disable/Lock Text Input Form Fields

> 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" />
Super Moderator
Featured Poster
Reputation Points: 3233
Solved Threads: 719
Failure as a human
~s.o.s~ is offline Offline
8,871 posts
since Jun 2006
Jul 30th, 2009
0

Re: Disable/Lock Text Input Form Fields

Thank you ~s.o.s~
Reputation Points: 10
Solved Threads: 1
Newbie Poster
Zion_Lion is offline Offline
1 posts
since Jul 2009
Jul 30th, 2009
0

Re: Disable/Lock Text Input Form Fields

Click to Expand / Collapse  Quote originally posted by ~s.o.s~ ...
> 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
Reputation Points: 10
Solved Threads: 1
Newbie Poster
benjiei is offline Offline
1 posts
since Jul 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: Expand function
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: need to autofill the textbox using ajax:autocomplete





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC