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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read only text Field

Status
Not open for further replies.

ggrewe

IS-IT--Management
Jul 10, 2001
169
US
If I have the following code, how do I make SpecialInvitationAmount so that it is read only and cannot be changed by the form user?

<td width=&quot;64%&quot;><input type=&quot;checkbox&quot; name=&quot;SpecialInvitation&quot; value=&quot;1&quot; onclick=&quot;SpecialInvitationAmount.value=149.50&quot;>Special
Invitation Offer $149.50 (valid until November 30, 2001)</td>
<td width=&quot;12%&quot;>
<p align=&quot;center&quot;>&nbsp; </td>
<td width=&quot;12%&quot; align=&quot;center&quot;></td>

<td width=&quot;12%&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;SpecialInvitationAmount&quot; size=&quot;8&quot;></td>
 
Probably you already know that IE4 has a READONLY attribute for <INPUT TYPE=TEXT> fields. This is not available in Netscape.

How about using onChange in the text field to start a script that assigns the value 149.50 to document.form[0].SpecialInvitationAmount.value ? At least if the person does edit the field your script will change it back to the value you need.

For that matter, why put a field on the form at all if you know what the price is, show it but don't make a field for it. Or, put the value in a hidden field.
Code:
<INPUT TYPE=hidden NAME=SpecialInvitationAmount VALUE=149.50>
 
I would love to show just the value, but not make it a field. I do not know how to do that. They do not want me to hidden the fields, they want the user to see the dollar amounts.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top