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!

locking update fields

Status
Not open for further replies.

bigbird3156

Programmer
Feb 20, 2001
183
AU
hi guys....

the other day kaht gave me an answer as to how to create a field that is updated when numeric values are put into various fields in a form (i.e it added them up and spat out the number)

it was great to get that answer, but I have come across 2 possible issues with it...

the first is that the total field is placed in a text box - and secondly that you can click on that text box and modify the content...

is there a way that I can write the total outside the textbox and have it "locked" so that users cant change the total?

[wiggle]The Bird from Down Under- Bigbird 3156
Programmer?? - I thought the option was pretender not programmer!![jester]
 
You can always set the disabled property of the text field so that it's content cannot be overwritten.
Otherwise you could have a SPAN or DIV tag on the page and write the value into that tag using it's innerhtml or innertext property. Then the text would not be contained within a form field that might be editable.

At my age I still learn something new every day, but I forget two others.
 
You can also set the readonly property on a textbox to prevent it from getting overwritten:
Code:
<input type="text" [!]readonly="readonly"[/!] />

-kaht

Looking for a puppy? [small](Silky Terriers are hypoallergenic dogs that make great indoor pets due to their lack of shedding and small size)[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top