473,385 Members | 1,813 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,385 software developers and data experts.

How do I prevent IE from reloading contents of Form fields?

Akatz712
I have a javascript routine which is at the bottom of the HTML right before the </body>. In it, I initialize some form fields. This code I know only gets executed when the page first loads and when I press reload (refresh) (F5). And in Firefox and in Opera, the form fields are reset in my javascript and it stays reset. However, in IE, after I reset the form fields in my javascript, IE is filling them out with what they had in them from before pressing refresh. How do I make IE behave like the other two browsers?
Apr 7 '07 #1
7 2502
acoder
16,027 Expert Mod 8TB
Have your javascript function run in the onload event handler:
Expand|Select|Wrap|Line Numbers
  1. window.onload=yourfunction;
Apr 9 '07 #2
Have your javascript function run in the onload event handler:
Expand|Select|Wrap|Line Numbers
  1. window.onload=yourfunction;
This seems to work fine for browsers other than Internet Explorer. With Internet explorer it throws an exception.
Apr 10 '07 #3
acoder
16,027 Expert Mod 8TB
Post your code.
Apr 10 '07 #4
me2tech
14
Post your code..
Apr 10 '07 #5
My code is involved, so I would have to do a test case. I will do that. But for now, I have added a button, which has the javascript function of cleaning up all the forms and reseting them to their initial values.
Apr 12 '07 #6
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Test javascript reset of radio buttons and reload</title>
</head>
<body>
<form name='Form'>
<input type="text" name="Entry" size="20">
</form>
<script type="text/javascript">
<!--
document.Form.Entry.value = "";
window.alert("Show that it is cleared now and then comes back.");
//-->
</script>
</body>
</html>

try that code. Enter something in the text box and press the refresh button on IE and you will see it come back. Firefox leaves it erased.
Apr 12 '07 #7
acoder
16,027 Expert Mod 8TB
Set the Entry field to empty:
[HTML]<input type="text" ... value="">[/HTML] Then there is also the reset() method of the form object which you can run on body onload, e.g.
[HTML]<body onload="document.forms[0].reset();">[/HTML] (Not recommended to do it this way, but you get the idea).
Apr 13 '07 #8

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

Similar topics

2
by: Snolly | last post by:
Hi all, Here is my issue. I have a web page (lets call it page1) with an iframe in it that then opens a pop-up window (page2). The pop-up window is used to edit some data that was loaded into...
4
by: Jonathan Strange | last post by:
I have a website that uses Forms, and if I complete the form fields, submit the form, realise that there was an error or omission, and then hit the Back button, the form fields are all empty. This...
2
by: Ben | last post by:
I have looked around for this but I seem to be missing something. I have a forum based on a query that brings display some table info in tabular form. What I would like to do is prevent the user...
9
by: Catherine Jo Morgan | last post by:
Can I set it up so that a certain combination of fields can't contain the same entries, on another record? e.g. a combination of FirstName/LastName/address? Or FirstName/LastName/phone? Or...
3
by: Randy | last post by:
I want to set up a table where I can enter dates that will prevent data entry of Dates in the Main table. I have done this in Approach by linking two tables and setting up a validation formula...
18
by: Gleep | last post by:
I've searched google intensely on this topic and it seems noone really knows how to approch this. The goal I don't want clients to give out their usernames and passwords to friends, since the site...
12
by: Larry Bud | last post by:
I rarely crosspost, but this affects both ASP and Javascript REALLY odd bug that I ran across in ASP 3.0. I have an input type of file, user clicks browse, then places his cursor in the...
4
by: Chris | last post by:
How can I refresh the contents of a gridview that's on a different form than the one I'm using? The gridview is bound to a datasource, and in this other form I'm writing to the database that this...
62
by: Wiretwisterz | last post by:
I am using Microsoft Office XP and I have developed an Access database that is used to schedule conference and training rooms within buildings. I have one main form named "Events" that is used to...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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.