?
Solved

FireFox and selected on page refresh

Posted on 2007-07-20
5
Medium Priority
?
1,474 Views
Last Modified: 2013-12-07
Based on this simple code:

    <select>
          
        <option value="0">S1</option>
         <option value="2" selected>S2</option>
        <option value="3">S3</option>
       
    </select>

Both IE and FireFox make the default selected value 2 (like they should) but when the page is refreshed IE goes back to the value 2 but FireFox does not. FireFox remebers the value that was selected when the page was refreshed.

Anyone know how to make FF act like IE with this?

Thanks in advance.
0
Comment
Question by:thinksysinc
  • 3
5 Comments
 
LVL 17

Accepted Solution

by:
jasonsbytes earned 1000 total points
ID: 19534345
This is a FF browser 'feature' that occurs when you do a 'soft' refresh (from the cache), if you force a hard refresh (reload from server) it acts the same.

You can force a hard refresh with 'ctrl+f5' instead of just 'f5'.

You can not control this from your code or html, it is something the user can configure in FF.  I must say, I rather LIKE the feature.
0
 
LVL 17

Expert Comment

by:jasonsbytes
ID: 19534366
actually, i just did some searching and it seems some folks believe you can turn it off... so, give this a try and let me know what happens:

http://developer.mozilla.org/en/docs/How_to_Turn_Off_Form_Autocompletion

Hope it works!
0
 

Author Comment

by:thinksysinc
ID: 19534436
jasonsbytes -

Yup you can turn it off. I tested it and it works.

I can see the good in having it remember the values but what I am doing right now it is causing me problems.

Either way, thanks for the help.
0
 
LVL 17

Expert Comment

by:jasonsbytes
ID: 19534540
no problem, thanks for the fun question and points!!! :)

I actually learned something too!
0
 
LVL 6

Expert Comment

by:neorush
ID: 19534621
A quick and dirty hack is to change the name of the form every time the page loads. Then FF resets all the form data to the defaults for instance:
<form name="testForm<?PHP echo rand(0,9999);?>">
<input type="text" value="test">
</form>

the other option is to set all the form data to defaults with JS, for instance:
<script language="Javascript">
window.onLoad = setTimeout("setdefaults()", 1000);
function setdefaults(){
  document.getElementById('testText').value = 'Default Value';
      
}
</script>
<form name="testForm">
<input type="text" name="testText" id="testText" value="test">

</form>
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
By following these Magento e-commerce development tips, you can increase your website's conversion and profitability. Read this post for more details.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question