Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

selected="selected" not working on firefox

Posted on 2008-06-09
4
Medium Priority
?
3,610 Views
Last Modified: 2013-12-07
I have a select box in a webpage that depending on a database registry it puts the value select="selected" on the option tag in the html...

this is accomplished... but the problem is althoug in the html code the option shows that it is selected firefox ignores it... in IE7 works fine... i don't know what could be the problem here's the code that prints the selected attribute...

while ($dato = mysql_fetch_object($datos))
            {
                  if ($center->address->state == $dato->id)
                  {
                        print("<option selected='selected' value='$dato->id'> $dato->name </option>");
                  }
                  else
                  {
                        print("<option value='$dato->id' > $dato->name </option>");
                  }
            }

this works fine and in the web page the result is:

<select name="_state" id="_state">
    <option value="null">Choose a State</option>
    <option value='1'>Texas</option>
    <option selected='selected' value='2' selected>California</option>
    <option value='3'>Washington</option>  
</select>

in firefox the selected option is always the "Choose a State" one...

I have search for a solution for this but haven't found any... is this a firefox bug??

thanks in advance...

Memo.
0
Comment
Question by:bluememon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 43

Expert Comment

by:David S.
ID: 21748652
It seems fine in Firefox 1.0.7, 1.5.x and 2.0.x (all on WinXP).
0
 

Accepted Solution

by:
bluememon earned 0 total points
ID: 21748725
Ohhh the problem was mine... I was trying to refresh the page and the drop down menu stayed where I selected even if the option california had the selected printed...

I'm going to be more careful next time I refresh my pages to test my code...

thanks for pointing me that out ^__________^

Memo.
0
 
LVL 43

Expert Comment

by:David S.
ID: 21748798
You're welcome. Try pressing Ctrl + F5 to force a full reload in the future.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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 . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
The viewer will learn how to dynamically set the form action using jQuery.
How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…

722 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