Solved

Firefox - Programmatically Select Dropdown value - HELP!

Posted on 2006-11-08
29
306 Views
Last Modified: 2008-02-01
I want to load a page, and once the page loads, use JS to automatically cause certain dropdown values to be selected - it seemed like it should be really simple - my page works fine in IE every time, but firefox gives some really weird results -

after the page loads, the displayed value on some of the <select> dropdowns is blank, BUT the correct value is actually selected - if you click the dropdown, you will see the correct value highlighted in blue...but it just doesn't actually display when the page loads...sometimes only the first 1 or 2 characters of the display value shows up

could someone please view the source at this page and tell me what i'm doing wrong? any help is greatly appreciated
http://www.webfixes.com/ee_questions/firefox_problem.htm

0
Comment
Question by:friskyweasel
  • 14
  • 7
  • 3
  • +3
29 Comments
 
LVL 6

Expert Comment

by:hc0904pcd
ID: 17904017
Hi frisky,
Im' not 100% certain of this, but I had a similar problem which I think was related to the values starting with a number.
Can you try putting a prefix in front of your dropdown values and see if that makes a difference?
0
 

Author Comment

by:friskyweasel
ID: 17904049
thanks for the response hc0904 - i put a "-" character in front of the hour and minute, but still no luck

it's a really weird behavior but i need to get this fixed in a bad way - any other ideas out there?
0
 
LVL 6

Expert Comment

by:hc0904pcd
ID: 17904073
what you've got at http://www.webfixes.com/ee_questions/firefox_problem.htm works for me, in FF1.5
did you try restarting firefox?
0
 
LVL 10

Expert Comment

by:iamanindian
ID: 17904075
Does this work for you?

----------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Letters From Santa for Christmas</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
      background-color: #FFFFFF;
      margin-left: 0px;
      margin-top: 0px;
      margin-right: 0px;
      margin-bottom: 0px;
}
-->
</style>
<link href="includes/s4xmas.css" rel="stylesheet" type="text/css">
<!--Javascript function to Populate Form Fields-->
<script language='Javascript'>
function setValues(){
document.custeditletterform.gender.value = "girl";
document.custeditletterform.bedtime_ampm.value = "PM";
document.custeditletterform.bedtime_hour.value = "07";
document.custeditletterform.bedtime_min.value = "45";
}
</script>
<!--END Javascript function to Populate Form Fields-->

<script language="javascript" src="includes/s4xmas.js"></script>
</head>

<body onLoad="setValues()">
<table width="600"  border="0" align="center" cellpadding="5" cellspacing="0">
  <tr>

    <td align="left" class="menulinks1">&nbsp;</td>
  </tr>
  <tr>
    <td width="100%">
<form method="post" name="custeditletterform" action="custeditletter.php">
      <table width="100%"  border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100%"><span class="bodytext">f elf has been telling me what a good
  <select name="gender" id="gender" onmouseover="javascript:return escape('Select whether your child is a boy or girl.');"><option value="null" selected>Gender</option><option value="boy">Boy</option><option value="girl">Girl</option></select>

  you havar, I am so proud of you for
 
  this school year. I ayou on my Nice List, you deserve it! I'll be sure to stop by
 
 early i to be in bed by
 <select name="bedtime_hour" id="bedtime_hour" onmouseover="javascript:return escape('The number representing the hour of your child\'s bedtime.');"><option value="null" selected>Choose Hour</option><option value="01">01</option><option value="02">02</option><option value="03">03</option><option value="04">04</option><option value="05">05</option><option value="06">06</option><option value="07">07</option><option value="08">08</option><option value="09">09</option><option value="10">10</option><option value="11">11</option><option value="12">12</option></select>:<select name="bedtime_min" id="bedtime_min" onmouseover="javascript:return escape('The the minutes time block - :00,:15, :30, :45 of your child\'s bedtime.');"><option value="null" selected>Minute Block</option><option value="00">00</option><option value="15">15</option><option value="30">30</option><option value="45">45</option></select> <select name="bedtime_ampm" id="bedtime_ampm" onmouseover="javascript:return escape('Select whether the bedtime is AM or PM.');"><option value="PM" selected>PM</option><option value="AM">AM</option></select>

  on f those
 
  that your house! </span></td>
</tr>
<tr align="center">
<td width="100%" align="center">&nbsp;</td>
</tr>
<tr align="center">
<td width="100%" align="center"><input name="Submit" type="submit"  value="Save Changes..." onClick="javascript:return genericval('custeditletterform');"> &nbsp;&nbsp; <input name="close_win" type="button"  value="Close Window" onClick="javascript: window.close();"></td>
</tr>
</table>
<input type="hidden" name="ua" value="formsubmitted"><input type="hidden" name="li_id" value="1"><input type="hidden" name="lt_id" value="1">      </form>

      </td>

  </tr>
</table>
<script language="javascript" src="includes/wz_tooltip.js"></script>
</body>
</html>

-----------------------------------------------------------------

Regards
WC
0
 

Author Comment

by:friskyweasel
ID: 17904088
hc0904 - nope it's not working in my version of firefox - here is a screenshot of what i get after a refresh or two (i included my "about firefox" page for version info)
http://www.webfixes.com/ee_questions/screenshot.jpg

iamanindian - fixing to try yours
0
 

Author Comment

by:friskyweasel
ID: 17904097
iamanindian - nope that didn't work either - i get a "0" for hour, "4" for minute, and "P" for AM/PM selection:
http://www.webfixes.com/ee_questions/firefox_problem2.htm


one weird thing to note - my HTML is in-line, but if i place a <br> tag after each dropdown, it magically starts working perfectly - see this link:
http://www.webfixes.com/ee_questions/firefox_problem3.htm

problem is, i can't use <br> tags b/c i need the dropdowns to flow in the text
0
 
LVL 6

Expert Comment

by:hc0904pcd
ID: 17904098
frisky,
apologies that my suggestion wasn't helpful, i may have been on the wrong track there.
0
 
LVL 5

Expert Comment

by:ewilde
ID: 17904120
i have no good explaination, but the solution is NOt to specify "selected" attribute in the FIRST option of the select element, but to specify it in another one.

please, try the code below.

regards,
ewilde.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Letters From Santa for Christmas</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
      background-color: #FFFFFF;
      margin-left: 0px;
      margin-top: 0px;
      margin-right: 0px;
      margin-bottom: 0px;
}
-->
</style>
<link href="includes/s4xmas.css" rel="stylesheet" type="text/css">
<script language="javascript" src="includes/s4xmas.js"></script>
</head>

<body>
<table width="600"  border="0" align="center" cellpadding="5" cellspacing="0">
  <tr>

    <td align="left" class="menulinks1">&nbsp;</td>
  </tr>
  <tr>
    <td width="100%">
<form method="post" name="custeditletterform" action="custeditletter.php">
      <table width="100%"  border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100%"><span class="bodytext">f elf has been telling me what a good
  <select name="gender" id="gender" onmouseover="javascript:return escape('Select whether your child is a boy or girl.');"><option value="null"

selected>Gender</option><option value="boy">Boy</option><option value="girl">Girl</option></select>

  you havar, I am so proud of you for
 
  this school year. I ayou on my Nice List, you deserve it! I'll be sure to stop by
 
 early i to be in bed by
 <select name="bedtime_hour" id="bedtime_hour" onmouseover="javascript:return escape('The number representing the hour of your child\'s

bedtime.');"><option value="null" >Choose Hour</option><option value="01" selected>01</option><option value="02">02</option><option

value="03">03</option><option value="04">04</option><option value="05">05</option><option value="06">06</option><option

value="07">07</option><option value="08">08</option><option value="09">09</option><option value="10">10</option><option

value="11">11</option><option value="12">12</option></select>:<select name="bedtime_min" id="bedtime_min" onmouseover="javascript:return

escape('The the minutes time block - :00,:15, :30, :45 of your child\'s bedtime.');"><option value="null" >Minute Block</option><option value="00"  

selected>00</option><option value="15">15</option><option value="30">30</option><option value="45">45</option></select> <select

name="bedtime_ampm" id="bedtime_ampm" onmouseover="javascript:return escape('Select whether the bedtime is AM or PM.');"><option

value="PM" selected>PM</option><option value="AM">AM</option></select>

  on f those
 
  that your house! </span></td>
</tr>
<tr align="center">
<td width="100%" align="center">&nbsp;</td>
</tr>
<tr align="center">
<td width="100%" align="center"><input name="Submit" type="submit"  value="Save Changes..." onClick="javascript:return genericval

('custeditletterform');"> &nbsp;&nbsp; <input name="close_win" type="button"  value="Close Window" onClick="javascript: window.close();"></td>
</tr>
</table>
<input type="hidden" name="ua" value="formsubmitted"><input type="hidden" name="li_id" value="1"><input type="hidden" name="lt_id"

value="1">      </form>

      </td>

  </tr>
</table>
<script language="javascript" src="includes/wz_tooltip.js"></script>
<!--Javascript function to Populate Form Fields-->
<script language='Javascript'>
document.custeditletterform.gender.value = "girl";
document.custeditletterform.bedtime_ampm.value = "PM";
document.custeditletterform.bedtime_hour.value = "08";
document.custeditletterform.bedtime_min.value = "45";
</script>
<!--END Javascript function to Populate Form Fields-->
</body>
</html>


0
 

Author Comment

by:friskyweasel
ID: 17904137
that's quite alright hc0904 - all suggestions are welcome - one other thing to chew on - see the "Gender" dropdown near the top (boy / girl)? it works perfectly for me every single time - i'm using the exact same type of javascript command to set it's value as i am for the hour, minute, and AM/PM boxes -

gender box works - others don't - if i re-arrange the <Select> tags in the HTML, then they start working - actually what you said is what i was wondering myself - possible buggy install of firefox - but i just want to be sure that other firefox users don't get the same behavior - anyone else have any ideas? i'd really like to understand why this is happening
0
 

Author Comment

by:friskyweasel
ID: 17904164
ewilde - i put your code up here:
http://www.webfixes.com/ee_questions/firefox_problem4.htm

unfortunately it's the same problem - this one loads correctly the first time, but the 1st refresh causes me to get "0", "4", and "P" for hour/minute/PM

yeah i can appreciate your point about not using "Selected" for the first option - but should that really cause a problem? in this particular case the flow of the page in my mind is: 1) the page loads with all default options selected and then 2) i use javascript to make the dropdown selections i want - just as if the user had done it - except it's done automatically
0
 
LVL 10

Expert Comment

by:iamanindian
ID: 17904194
Ok...another try...does this work?

-------------------------------------------------------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Letters From Santa for Christmas</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
     background-color: #FFFFFF;
     margin-left: 0px;
     margin-top: 0px;
     margin-right: 0px;
     margin-bottom: 0px;
}
-->
</style>
<link href="includes/s4xmas.css" rel="stylesheet" type="text/css">
<!--Javascript function to Populate Form Fields-->
<script language='Javascript'>
function setValuesA(){
document.custeditletterform.gender.options[2].selected=true;
document.custeditletterform.bedtime_ampm.options[0].selected=true;
}
function setValuesB(){
document.custeditletterform.bt_hour.options[7].selected=true;
document.custeditletterform.bedtime_min.options[4].selected=true;
}
</script>
<!--END Javascript function to Populate Form Fields-->

<script language="javascript" src="includes/s4xmas.js"></script>
</head>

<body onLoad="setValuesB(),setValuesA()">
<table width="600"  border="0" align="center" cellpadding="5" cellspacing="0">
  <tr>

    <td align="left" class="menulinks1">&nbsp;</td>
  </tr>
  <tr>
    <td width="100%">
<form method="post" name="custeditletterform" action="custeditletter.php">
     <table width="100%"  border="0" cellspacing="0" cellpadding="0">

<tr>
<td width="100%"><span class="bodytext">f elf has been telling me what a good
  <select name="gender" id="gender" onmouseover="javascript:return escape('Select whether your child is a boy or girl.');"><option value="null" selected>Gender</option><option value="boy">Boy</option><option value="girl">Girl</option></select>

  you havar, I am so proud of you for
 
  this school year. I ayou on my Nice List, you deserve it! I'll be sure to stop by
 
 early i to be in bed by
 <select name="bt_hour" id="bt_hour" onmouseover="javascript:return escape('The number representing the hour of your child\'s bedtime.');">
 <option value="null" selected>Choose Hour</option>
 <option value="01">01</option>
 <option value="02">02</option>
 <option value="03">03</option>
 <option value="04">04</option>
 <option value="05">05</option>
 <option value="06">06</option>
 <option value="07">07</option>
 <option value="08">08</option>
 <option value="09">09</option>
 <option value="10">10</option>
 <option value="11">11</option>
 <option value="12">12</option>
 </select>:<select name="bedtime_min" id="bedtime_min" onmouseover="javascript:return escape('The the minutes time block - :00,:15, :30, :45 of your child\'s bedtime.');"><option value="null" selected>Minute Block</option><option value="00">00</option><option value="15">15</option><option value="30">30</option><option value="45">45</option></select> <select name="bedtime_ampm" id="bedtime_ampm" onmouseover="javascript:return escape('Select whether the bedtime is AM or PM.');"><option value="PM" selected>PM</option><option value="AM">AM</option></select>

  on f those
 
  that your house! </span></td>
</tr>
<tr align="center">
<td width="100%" align="center">&nbsp;</td>
</tr>
<tr align="center">
<td width="100%" align="center"><input name="Submit" type="submit"  value="Save Changes..." onClick="javascript:return genericval('custeditletterform');"> &nbsp;&nbsp; <input name="close_win" type="button"  value="Close Window" onClick="javascript: window.close();"></td>
</tr>
</table>
<input type="hidden" name="ua" value="formsubmitted"><input type="hidden" name="li_id" value="1"><input type="hidden" name="lt_id" value="1">     </form>

     </td>

  </tr>
</table>
<script language="javascript" src="includes/wz_tooltip.js"></script>
</body>
</html>

-------------------------------------------------------------------------------------------------------

Regards
WC
0
 

Author Comment

by:friskyweasel
ID: 17904205
iamindian - same result as ewilde's script - on my firefox browser, that page loads correctly on the first page load, but i get "0","4", and "P" on every subsequent page refresh - i have no clue what is going on here : )
0
 

Author Comment

by:friskyweasel
ID: 17904207
oh - here's the link to that latest snippet you provided:
http://www.webfixes.com/ee_questions/firefox_problem5.htm
0
 
LVL 17

Expert Comment

by:gops1
ID: 17904233
Change your function to this:

function setValuesA(){
      document.custeditletterform.gender.selectedIndex=2;
      document.custeditletterform.bedtime_ampm.selectedIndex=0;
}
function setValuesB(){
      document.custeditletterform.bt_hour.selectedIndex=7;
      document.custeditletterform.bedtime_min.selectedIndex=4;
}

and on your body, the two function calls you have seperated with a comma but it should be a semi colon(;). Like this:

<body onLoad="setValuesB();setValuesA()">
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 10

Expert Comment

by:iamanindian
ID: 17904252
Hmnn...I am running FF 1.5.0.4 & though the original code was giving trouble, the updated code works fine now (e.g. http://www.webfixes.com/ee_questions/firefox_problem5.htm). I am downloading 1.5.0.8, lets see if that helps in figuring out the issue.

Regards
WC
0
 

Author Comment

by:friskyweasel
ID: 17904288
i didn't have any luck with that either gops1 -

the weird thing here - as i mentioned in my first post, is that it's actually selecting the correct value every time - even the very first file i posted.....it's just not displaying the correct value - i don't think getting firefox to know which one to select is the problem - the problem is just that it won't actually show it on the screen as being selected

quick for instance - when i get "0" for the hour instead of the correct "07"....if i click and dropdown the select box, the entry "07" is actually highlighted in blue - it's selecting it - it's just not displaying it correctly....
0
 
LVL 5

Expert Comment

by:ewilde
ID: 17904382
still have no explaination...
but try this:

1. remove the "selected" attributes from all of the options (there are 4, 1 for each select)
2. move this line: document.custeditletterform.gender.value = "girl"; to the end of the script!

0
 

Author Comment

by:friskyweasel
ID: 17904425
well ewilde for the time being i think i stand corrected on whether or not having "selected" for the first option makes a difference - i didn't think it would, but removing all of the "selected" attributes appears to have worked! i removed the "selected" values, and moved the gender/girl portion of the script to the end - it worked every time....i then moved the gender/girl portion of the script back to the beginning (where it was to start with), and it still works - looks very good so far - have to crash now - i want to test it some more tomorrow - if the results hold up then the points are yours!

thanks to everybody that contributed!
0
 

Author Comment

by:friskyweasel
ID: 17904509
well ewilde i take that back - i'm still having the problem - it worked on my little test page, but when i implemented the same logic in a more in-depth scenario (more select dropdowns), i started seeing the same behavior again, even with all of the "selected"'s removed and reordering the script entries  : (

0
 
LVL 3

Expert Comment

by:inubis
ID: 17904753
Hi,

Don't have an ideal solution for but:
setTimeout('document.custeditletterform.bedtime_hour.value = "-07";', 100);
Better that this might be to do it in function registered to the body onload
<body onload="document.custeditletterform.bedtime_hour.value = '-07';">

This sets the value after the page has finished rendering.

The only downside to this is your see the value flick to correct value once the page loads.

Sam
0
 
LVL 3

Expert Comment

by:inubis
ID: 17904763
Sorry, didn't read the above comments close enough since my solution using onload is almost the same as iamanindian's
0
 

Author Comment

by:friskyweasel
ID: 17906659
still not having 100% success - here's the behavior that i'm noticing, and have been able to replicate in Firefox on 2 different machines:

this one doesn't work at all: (my original one)
1st  - http://www.webfixes.com/ee_questions/firefox_problem.htm

this one works every single time (<br> tags after dropdowns)
2nd - http://www.webfixes.com/ee_questions/firefox_problem3.htm

in BOTH cases, the "gender" (girl) dropdown works every time

can anyone tell me why the first one doesn't work, but the 2nd one does? and why doesn't the problem apply to the Gender dropdown as well? i'm clueless here
0
 

Author Comment

by:friskyweasel
ID: 17906680
also - i'm just wondering - are you guys seeing the same problems i am describing when using firefox?
0
 
LVL 10

Expert Comment

by:iamanindian
ID: 17907174
Ok, I have managed to download & test this page (http://www.webfixes.com/ee_questions/firefox_problem5.htm) on FF 1.5.0.8...I am also observing the same error. Interesting bug...can we check with FF? I will try to dig more into it.

Regards
WC

0
 
LVL 10

Expert Comment

by:iamanindian
ID: 17907926
Tried a clean approach:

----------------------------------------------------------------------------------------------------

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Letters From Santa for Christmas</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!--Javascript function to Populate Form Fields-->
<script language='Javascript'>
function setValuesA(){
document.custeditletterform.gender.options[2].selected=true;
document.custeditletterform.bedtime_ampm.options[0].selected=true;
document.custeditletterform.bt_hour.options[7].selected=true;
document.custeditletterform.bt_min.options[4].selected=true;
}
</script>
<!--END Javascript function to Populate Form Fields-->
</head>
<body>
<table width="600"  border="0" align="center" cellpadding="5" cellspacing="0">
  <tr>
    <td align="left" class="menulinks1">&nbsp;</td>
  </tr>
  <tr>
    <td width="100%">
<form method="post" name="custeditletterform" action="custeditletter.php">
     <table width="100%"  border="0" cellspacing="0" cellpadding="0">

<tr>
<td width="100%"><p class="bodytext">
      <select name="gender" id="gender" onmouseover="javascript:return escape('Select whether your child is a boy or girl.');">
            <option value="NULL" selected>Gender</option>
            <option value="boy">Boy</option>
            <option value="girl">Girl</option>
      </select>
  <br>
  <select name="bt_hour" id="bt_hour" onmouseover="javascript:return escape('The number representing the hour of your child\'s bedtime.');">
    <option value="0">Select</option>
       <option value="01">01</option>
       <option value="02">02</option>
       <option value="03">03</option>
       <option value="04">04</option>
       <option value="05">05</option>
       <option value="06">06</option>
       <option value="07">07</option>
       <option value="08">08</option>
       <option value="09">09</option>
       <option value="10">10</option>
       <option value="11">11</option>
       <option value="12">12</option>
  </select>
  <br>
  <select name="bt_min" id="bedtime_min" onmouseover="javascript:return escape('The the minutes time block - :00,:15, :30, :45 of your child\'s bedtime.');">
    <option value="0">Select</option>
      <option value="00">00</option>
      <option value="15">15</option>
      <option value="30">30</option>
      <option value="45">45</option>
  </select>

    <select name="bt_ampm" id="bedtime_ampm" onmouseover="javascript:return escape('Select whether the bedtime is AM or PM.');">
      <option value="PM">PM</option>
      <option value="AM">AM</option>
     </select>
 
</p>
</td>
</tr>
<tr align="center">
<td width="100%" align="center">&nbsp;</td>
</tr>
<tr align="center">
<td width="100%" align="center"><input name="Submit" type="submit"  value="Save Changes..." onClick="javascript:return genericval('custeditletterform');"> &nbsp;&nbsp; <input name="close_win" type="button"  value="Close Window" onClick="javascript: window.close();"></td>
</tr>
</table>
<input type="hidden" name="ua" value="formsubmitted"><input type="hidden" name="li_id" value="1"><input type="hidden" name="lt_id" value="1">     </form>

     </td>

  </tr>
</table>
<script language="javascript">
setValuesA();
</script>
</body>
</html>

----------------------------------------------------------------------------------------------------

Does this work?

Regards
WC
0
 

Author Comment

by:friskyweasel
ID: 17909878
yeah man that works - but that's the weird thing - notice in my 2nd to last post above, where i mentioned the different scenarios - the one that i was saying works every single time - it's when i put <br> tags between the select dropdowns....i know it sounds crazy - but that seems to be what's making the difference - every function provided by every person that responded has worked in principle - it DOES cause firefox to select the correct dropdown item, but the problem is when it comes time for Firefox to render that selected item on the screen

that's why i thought there must be some very basic javascript principle that i'm violating here - because why in the world should adding a break tag (<br>) before and/or after the select dropdown box cause my javascript to start working flawlessly? makes no sense to me -

in any case - yup that last bit of code you posted works 100% of the time in both firefox and IE, but the remaining problem is that i need to be able to have the <select dropdown box appear right in line with the text - so that it will flow just as if they're reading a letter and filling in the blanks...

argh! : ) thanks for all the help so far
0
 
LVL 10

Accepted Solution

by:
iamanindian earned 500 total points
ID: 17911206
Well...I thought that got fixed (I just didn't use the text, but did use line breaks). Now I am adding the text...doesn't this work?

---------------------------------------------------------------------------------------------------------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Letters From Santa for Christmas</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!--Javascript function to Populate Form Fields-->
<script language='Javascript'>
function setValuesA(){
document.custeditletterform.gender.options[2].selected=true;
document.custeditletterform.bedtime_ampm.options[0].selected=true;
document.custeditletterform.bt_hour.options[7].selected=true;
document.custeditletterform.bt_min.options[4].selected=true;
}
</script>
<!--END Javascript function to Populate Form Fields-->
</head>
<body>
<table width="600"  border="0" align="center" cellpadding="5" cellspacing="0">
  <tr>
    <td align="left" class="menulinks1">&nbsp;</td>
  </tr>
  <tr>
    <td width="100%">
<form method="post" name="custeditletterform" action="custeditletter.php">
     <table width="100%"  border="0" cellspacing="0" cellpadding="0">

<tr>
<td width="100%"><p class="bodytext">f elf has been telling me what a good  
  <select name="gender" id="gender" onmouseover="javascript:return escape('Select whether your child is a boy or girl.');">
    <option value="NULL" selected>Gender</option>
    <option value="boy">Boy</option>
    <option value="girl">Girl</option>
  </select>
  you havar, I am so proud of you for this school year. I ayou on my Nice List, you deserve it! I'll be sure to stop by early i to be in bed by
  <select name="bt_hour" id="bt_hour" onmouseover="javascript:return escape('The number representing the hour of your child\'s bedtime.');">
    <option value="0">Select</option>
    <option value="01">01</option>
    <option value="02">02</option>
    <option value="03">03</option>
    <option value="04">04</option>
    <option value="05">05</option>
    <option value="06">06</option>
    <option value="07">07</option>
    <option value="08">08</option>
    <option value="09">09</option>
    <option value="10">10</option>
    <option value="11">11</option>
    <option value="12">12</option>
  </select>
  :  
  <select name="bt_min" id="bedtime_min" onmouseover="javascript:return escape('The the minutes time block - :00,:15, :30, :45 of your child\'s bedtime.');">
    <option value="0">Select</option>
    <option value="00">00</option>
    <option value="15">15</option>
    <option value="30">30</option>
    <option value="45">45</option>
  </select>
  <select name="bt_ampm" id="bedtime_ampm" onmouseover="javascript:return escape('Select whether the bedtime is AM or PM.');">
    <option value="PM">PM</option>
    <option value="AM">AM</option>
  </select>
  on f those that your house!
</p>
</td>
</tr>
<tr align="center">
<td width="100%" align="center">&nbsp;</td>
</tr>
<tr align="center">
<td width="100%" align="center"><input name="Submit" type="submit"  value="Save Changes..." onClick="javascript:return genericval('custeditletterform');"> &nbsp;&nbsp; <input name="close_win" type="button"  value="Close Window" onClick="javascript: window.close();"></td>
</tr>
</table>
<input type="hidden" name="ua" value="formsubmitted"><input type="hidden" name="li_id" value="1"><input type="hidden" name="lt_id" value="1">     </form>

    </td>

  </tr>
</table>
<p>
  <script language="javascript">
setValuesA();
</script>
</body>
</html>
---------------------------------------------------------------------------------------------------------------------------------------------------------

Regards
WC
0
 

Author Comment

by:friskyweasel
ID: 17938610
sorry for the long delay iamindian - i was out of town - yeah that sure does seem to work - i'm going to try to break down what is different between your last example and what i currently have - thanks a bunch for all your help
0
 
LVL 10

Expert Comment

by:iamanindian
ID: 17939577
Glad to be of any help. :)

Regards
WC
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

760 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now