473,387 Members | 1,572 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

how to clear textfields when browser refresh button cliked in mozilla

hi,
I have login page , userid and password , when i entered values into them and click browser refresh in MOZILLA , password field clears but userid field text doesnt clears, how to clear userid field. in IE both fields clears, problem is with Mozilla only. It's urgent Plz help me.
Feb 11 '09 #1
8 25616
PRR
750 Expert 512MB
you could clear the text boxes using java script
Expand|Select|Wrap|Line Numbers
  1. function myfunction()
  2. {
  3.  
  4. document.getElementById('TextBox1').value="";
  5.  
  6.  
  7. }
  8. <body onload="myFunction()">
  9.  
Feb 11 '09 #2
Frinavale
9,735 Expert Mod 8TB
You could also disable ViewState for the user id TextBox.
It will not retain it's values then.

Also, you could clear the text boxes in your server code (in the PreRender event):
Expand|Select|Wrap|Line Numbers
  1.    myUserIdTextBox.Text = ""
  2.    myPassword.Text = ""
Your password field should not keep it's value though, usually this clears automatically if you have indicated that the TextBox is for a password.
Feb 11 '09 #3
@charithstudy


On button click

txtuserid.text=""
Feb 27 '09 #4
If the user textbox is not clearing then u might try ds
on ur button click event,
txtUserid.Text = ""
Mar 6 '09 #5
As you've noticed, this is an issue specific to Netscape/Gecko-based browsers. When you clear the cache from the Tools menu then the issue is resolved. But by default this occurs as a result of the built-in feature called Form and Password Auto-completion.

The suggested solutions given are good, although it seems like a strange function to have to implement. Alternatively, a more precise method is to use the autocomplete attribute in either your FORM element or to each individual INPUT element:

Expand|Select|Wrap|Line Numbers
  1.  
  2. <form autocomplete="off">
  3. </form>
  4.  
  5. OR
  6.  
  7. <input type="text" autocomplete="off" />
  8.  
You can read more about it here:
http://devedge-temp.mozilla.org/view.../index_en.html

Can I ask why it's imperative that you have your login page this way?
Mar 11 '10 #6
how can i clear the textfield data while click on the back button to come to old page.
Sep 27 '10 #7
Frinavale
9,735 Expert Mod 8TB
Hi :)
Welcome to Bytes.

When you hit the back button, the browser displays a version of the page that it cached. Your server-side code cannot detect this and so you cannot use C# or VB.NET code to clear the data.

You can try using meta tags to indicate that the page has expired (as soon as it's sent) and to indicate that no caching should happen. But meta tags are just suggestions and they don't work in all browsers.

The best solution that I have found is to place all of your page controls into an UpdatePanel. This will result in asynchronous postbacks to the server and the browser cannot cache this. So, when the user hits the back button, the page that is displayed is the version of the page that was sent to the browser during the first page request.

-Frinny
Sep 27 '10 #8
@ rbuczynski

Thanks MAN!
it Works ;)
Oct 30 '10 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Andrus Moor | last post by:
I want to add a refresh button to my web page which works like browser refresh button: it must re-load current page from server. How to implement this in javascript ?
7
by: milkyway | last post by:
Hello to all ;-) I am using the Visual Studio 2005 .NET framework. Basically, I have file that is served up as an HTML file on the client side (generated from a .aspx file). But - the HTML...
10
by: tasmisr | last post by:
This is an old problem,, but I never had it so bad like this before,, the events are refiring when clicking the Browser refresh button. In the Submit button in my webform, I capture the server side...
2
by: Jaikanth Sithambaranathan via .NET 247 | last post by:
The problem is in the result page in which i can scroll throughthe contents of the result set 100 at a time. I call the resultpage from a filter page where i accept filter on results to bedisplayed....
9
by: Navaneet | last post by:
Hi, Can anyone tell me how to prevent some particular POST DATA when refresh button (F5) clicked on server side(vb.net). Thanks Kumar N
1
by: sreedhardasi | last post by:
Hi, I would like to call a javascript function when user clicks on browser's close button. Here is the scenario. 1. User clicks browser close button. 2. User will be displayed a popup or a...
4
by: valhalen | last post by:
Hi, I am trying to redirect the user to another page (other than the previous one in the browser's history) when the browser's (IE's) BACK button is clicked. I found this snippet, but am finding...
4
by: deeas | last post by:
hi , please i have problem and need help when i use visual basic in asp the browser cann't open it i wish you understand me can you help me.
8
rrocket
by: rrocket | last post by:
I have a form that has various tables that are hidden. When the user selects a number from the DDL the corresponding number of tables shows up (using javascript). When the submit button is clicked...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.