Learning While Aging

Prevent browser from remembering inputted data in text box

Browser has a handy feature that remembers the information entered earlier in text boxes, and this feature can save you a lot of time when you fill up a form on-line. Sometimes, however, this feature may cause unwanted behaviors, even security concerns. For example, browser should not remember the credit card number that was entered. Another example is if you have a RegularExpressionValidator to validate a text box field, and if the text box has history data, then you will be surprised that the RegularExpressionValidator will not fire when you move away your cursor from the text box if you fills the text box by selecting data from the history data. You have to click a button to trigger the validator to validate.

Since it is not practical to ask your users to change their browsers’ settings to disable this feature, developer should do something to let browser know that a specific text box should be skipped when saving history data.

In Visual Studio 2005, TextBox control has a new property called “AutoCompleteType”, and when it is set to “Disabled”, browser will not save any data entered in this TextBox.

Prior to .NET 2.0, you can use this line to accomplish the same mission as above:

TextBox1.Attributes.Add(“autocomplet”, “off”)

Let me know if this helps you.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x