tags:

views:

378

answers:

5

hi friends,

In my asp page there is one textbox name "ProductName"

if i write any thing in that textbox and refresh that page , textbox is not clear in firefox. But i open this same page in Internet explore and write any thing in textbox and refresh the page, my textbox comes clear

why textbox not comes clear in FireFox?

This is the html code

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>
<body>
<input type="text" id="ProductName" name="ProductName" style="width:235; height:20" value="">
</body>
</html>
+4  A: 

This is a feature of Firefox (one I'm quite fond of). There's nothing you can do about it on the server-side.

EDIT:

The longer version: There is something you can do about, but it's very messy. Basically, the way Firefox implements this is it refills in form elements with the same name when the user hits the refresh button.

The workaround is to change the name attribute on your HTML form elements every time the page loads. How you keep track of what you change them too is left to your discretion, but let me just say that as a Firefox user myself, having a website do this would annoy me no end.

Matthew Scharley
A: 

I saw a website which is

http://dev-tips.com/featured/create-a-simple-input-sanitation-function-with-php

the name of the input still remind the same, but when I input there, i refresh the value is clear, I am using firefox.

Anyone know how to solve this?

Shiro
+1  A: 

Actually firefox is stupid that way. Let's say you have a checkbox and when the user clicks to activate that checkbox there is a div that should fade in. The problem here is that if you refresh the page your checkbox will remain active but your div will be hidden. They(firefox) did not think it all the way through and that is .. well stupid. Because of that you have to resort to js workarounds which (I'm not quite fond of).

I do agree that you need to have, at some poin, the same value inside some input, like when you submit a page, there is an error and you need to redirect the user back to the page containing the form. Then yeah!, ok!, you need the values... but to keep the values on refresh , well that s just stupid.

What user enters his details and then just thinks "hm I'll just press f5 now see what happens". If that's the kind of user 'roaming round' your site, please shut it down it's infested with stupidity

Ok so now that that is out of the way.

"change the name attribute on your HTML form elements every time the page loads" this is a bad idea don`t do this...

instead you can use a js function that simply gets the input and sets the value to ""

onpageload:
document.getElementById('inp1').value = '';
document.getElementById('inp2').value = '';
document.getElementById('inp3').value = '';

and so on and so forth. P.S. this is just an example, it's your job to see, what fits for you (be it jquery, prot or whatever); to see if you use a for loop or not; etc

alinmircea
A: 

"Actually firefox is stupid that way." - yes it is.

Another way would be to set autocomplete="off" on the input

ionectu
A: 
M. M.