Solved

select option not showing

Posted on 2011-02-11
11
304 Views
Last Modified: 2012-06-27
Hi,

There is a select option within a <td> but it's not showing for some reason. I don't see any errors in my code (my IDE) and when I copy and paste the <select> before the body tag it shows up. What's wrong?

http://tutorialref.com/mhms/btgapp.php

Thanks,
Victor
0
Comment
Question by:Victor Kimura
  • 4
  • 3
  • 2
11 Comments
 
LVL 51

Expert Comment

by:HainKurt
ID: 34872984
you mean this part? there is nothing wrong here and I can see it..
<table align="center" cellpadding="3" style="width: 97%; border:1px solid red">
<tr>
   <td style="width: 50%; padding-bottom: 3px; height: 23px;">&nbsp;* Which class would you like to attend?</td>
   <td style="width: 50%; padding-bottom: 3px; height: 23px;">
      <select name="Which_Class" style="width:250px; height:20px;">
         <option>-- Select Class Date --</option>
         <option value="January 24, 2011" selected>January 2011 - Classes Start Jan 24
         </option>
      </select></td>
</tr>
...
</table>

Open in new window

0
 
LVL 51

Expert Comment

by:HainKurt
ID: 34873022
it is because of this

      <script language="JavaScript" src="http://tutorialref.com/mhms/scripts/init.js"></script>
0
 
LVL 51

Expert Comment

by:HainKurt
ID: 34873035
I guess this function is responsible for that
/**
************************************
* For btgapp.php
************************************/
function checkDates(){
   var dateDiff
   var ddDate
   var today = new Date()
   var oneDay=1000*60*60*24
   var dateDD = document.btgapp.Which_Class
   var numOpts = dateDD.options.length
   //Remove dropdown options with dates less than 4 weeks out
   for (var i=numOpts-1;i>=0; i--) {
      ddDate = new Date(dateDD.options[i].value)
      dateDiff = (ddDate.getTime()-today.getTime())/oneDay/7
      //alert("dateDiff is: "+dateDiff)
      if (dateDiff < 4){
         dateDD.remove(i)
      }
   }
}

Open in new window

0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 51

Expert Comment

by:HainKurt
ID: 34873037
//Remove dropdown options with dates less than 4 weeks out

:)
0
 
LVL 3

Assisted Solution

by:computino
computino earned 500 total points
ID: 34873055
You miss the second option of your select, right? That may be because of your very old way to format that option, I have no other explanation. Everything looks fine, but the option does not even get parsed by the browsers.

Try this version with two major changes, selected="selected" and I got rid of the giant whitespace before the closing </option>:

<option value="January 24, 2011" selected="selected">January 2011 - Classes Start Jan 24</option>
0
 
LVL 3

Expert Comment

by:computino
ID: 34873179
HainKurt let's my suggestion look dumb - I overlooked the JS file.
0
 

Accepted Solution

by:
Victor Kimura earned 0 total points
ID: 34874011
Thanks, fellows. I think there is a problem with the way javascript parses values with space. I changed the value with no spaces. Will accept dashes and underscores too.
0
 

Author Comment

by:Victor Kimura
ID: 34892162
Hi,

I appreciated HainKurt's responses. His response ( 34873037) was the solution he offered but that wasn't the answer. I know HainKurt's responded to other postings I've posted so I do appreciated his answers. It just wasn't the correct answer. Should I offer points to him for his effort? I can split the points.

computino's response (34873055) was the closest. Though the answer wasn't completely correct. The problem was the white spaces in the value of the option and not the option innerHTML text. That's why awarded him the 500 points.

I'm thinking that JS and/or jQuery values may need to be urlencoded (if there are whitespaces) but I'm not certain.

Split the points for the effort I think. Don't know how to do that on my end though. Thanks fellows. I appreciated your responses. =)
0
 

Author Closing Comment

by:Victor Kimura
ID: 34904835
Thank you.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Find out what you should include to make the best professional email signature for your organization.
Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

776 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