I'm making a web app to manage product SKUS. One part of that is to associate SKUs with product names. On each row of a table, I list a SKU and display a <select>
box with product names. The product that's currently associated with that SKU in the database is given an attribute like selected="selected"
. This can be changed and updated via AJAX.
There are a lot of product <option>
s - 103 to be exact - and this list is repeated in the <select>
on each row.
From another input on the page, I am using jQuery AJAX requests to add new SKU/product associations, and to make it clear that they're added instantly, I insert them into the top of the table with a little highlight effect. As the number of SKUs increases past 10 or so, if I refresh the page (which loads everything back out of the database ordered by product name), Firefox starts to show some wrong options as selected by default. It is not consistent about which incorrect option it shows, but it seems to be mixing up the options that existed before the page reload.
If I inspect the <select>
using Firebug, the select="selected"
is on the correct <option>
tag. Refreshing the page (or leaving and typing this page's URL back in to return) does not make it show up correctly, but hard refreshing (Ctrl+F5) does.
Both Chrome and IE7 display this correctly in the first place.
My theory is that this is a result of a faulty cache strategy by Firefox. Does that sound right? Is there any way I can say in my code "if this page is refreshed, make it a hard refresh - reload everything from scratch?"
To solve this problem, I changed strategies.
<select>
with a long list of <option>
s on each table row, with the current value set as default<span>
. If the user clicks a "change" button, I replace the <span>
with a <select>
, and the "change" button becomes a "confirm" button. If they change options and click confirm, AJAX updates the database, the and the <select>
goes back to being a <span>
, this time with the new value.This has two benefits:
<option>
s)Click the orange Firefox button to open the menu, then click on the word Options to open the options window. On the Menu Bar click on Tools, Options is the last on the list. On the Menu Bar click on Tools, Options is the last on the list.
In the Menu bar at the top of the screen, click Firefox and select Preferences. Click the menu button.
Change the default browser in Settings Press Win + I on the keyboard to open the Settings app. Choose Apps and go to Default apps. Find and go to Firefox. Click on Set default as shown in the screenshot.
I had a similar problem, but after adding autocomplete="off"
HTML attribute to every select tag it worked. [I was using Firefox 8]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With