Thanks, I'm not really awake now either, but this is a cliff-hanger and I keep looking to see what's new. I never expected to set a bunch of you to editing long javascripts. Maybe LoganK will find the rest, but I should probably post it on a JS forum and see if I can save him the time. If it worked it would be great. I'll let you know if someone fixes it.

    What other problems are you having? As far as I know, leatherback fixed the first problem with the vars, and I helped you identify the source of the second...what else is wrong? Let me know and I'll see what I can do.

      Leatherback, slight bug with that working script - the first letter results that you find are included in every other result. For example, if I typed "a", it gives me all of the stuff beginning with "a". But, if I then backspaced and typed "e", it gives me all of the "e" products, along with all of the "a" products. And if I backspace again and type "p", it erases the "e" products, displays the "p" products, but still keeps the "a" products. Apparently, they didn't code the removal correctly. They should add a small change saying that if the value of the textbox is null, to remove all values from the select box and reset it to the default "---------------------".

        Then it's probably what I said it was - IE's "helpful" debugger. I haven't seen a way to get around it yet.

        Saw this about the source, but afraid it's isn't enough to tell me how to fix it (or what to fix); and what about leatherback's

        var d = document.getElementById("display"); : Display does not exist

        ? I can fix the spelling mistakes he found, but that's all.

          Hi Lila,

          The IE debugger is actually helpful. In mozilla, the script didn't give off errors (report errors sitched off) but.. THe script didn't work either. So you should have the bugs fixed.

          Indeed, the points I mentioned also can give quite some more headaches.. I am not clear enough now to look at it. -see your priv. mess-

          J.

            lila wrote:

            Saw this about the source, but afraid it's isn't enough to tell me how to fix it (or what to fix);

            There really isn't a way to "fix" it except for disabling the JS debugger in IE...technically, it's correct JS so nothing is wrong with it. You might want to do something like this:

            var sel = "";
            var (other variable for function) = "";
            
            lila wrote:

            and what about leatherback's ? I can fix the spelling mistakes he found, but that's all.

            Easy enough - it's looking for an element on the page with the ID "display". If you're not using it, then remove the line, or create a blank div with id="display".

              LoganK wrote:

              There really isn't a way to "fix" it except for disabling the JS debugger in IE...technically, it's correct JS so nothing is wrong with it. You might want to do something like this:

              Easy enough - it's looking for an element on the page with the ID "display". If you're not using it, then remove the line, or create a blank div with id="display".

              Hm.. Lila.. I do NOT agree with LoganK 's opinion here:

              • It is not correct javascript, in the matter that it doesn't work. The references which are made when the functions are called, are causing the errors. The names are meant to refer to names, and should have quotes around them. They are not meant as variables (which would not have quotes), and are therefore throwing errors.

              The ID with display is used to reset part of the script. So even though YOU are not using it, the script needs the ID -> It looks for a DOM.node in the area with id="display". I tried simulating it, but came deeper and deeper in the scripts' errors.

              Anyway.. You posted the script to a JS forum. I will look at it tomorrow, if you tell me so. See the messages I sent you earlier.

              J.

              Logan.. /no comment, you know what I mean. /

                Ok...I've done stuff like this before and the JS worked fine, so I don't know how it's incorrect JS...how else do you define a function which accepts params in JS??

                Why wouldn't simply creating a blank div with id="display" work?

                Unfortunately, I don't know what you mean...PM me with the info?

                  Okay, I'm in way over my head here, if it's this hard to fix JavaScript, I need to do something else. If you told me to fix similar things in php maybe I could, but none of this means anything to me and it's a waste of your time.

                  I got this today from CodingForums, it works beautifully - but again, it has the options in the JS. Is this another case where it can't use the php options?
                  If so I think I will just make a really long options list with the 60-70 genus names, that will solve all our problems! Except that then it won't be dynamic related to the GENUS table, which hopefully will grow over time... So it's good code, bad database use.

                  <HTML>
                  <Head>
                  <Script Language=JavaScript>
                  
                  var smartOptions = new Array();
                  
                  var allOptions = new Array();
                  allOptions[0] = "Babich, Timothy";
                  allOptions[1] = "Cahoon, Ron";
                  allOptions[2] = "Atwood, James";
                  allOptions[3] = "Cannon, Edith";
                  allOptions[4] = "Allen, Mike";
                  allOptions[5] = "Bailey, Mary";
                  allOptions[6] = "Aaron, Daniel";
                  allOptions[7] = "Alexander, Allison";
                  allOptions[8] = "Baker, George";
                  allOptions[9] = "Conner, Anthony";
                  
                  function buildSmartOptions(isForm){
                  
                  	matchStr = isForm.isText.value.toLowerCase();
                  	if (matchStr != "")
                  		{
                  		 smartOptions.length = 0;
                  		 n = 0;
                  		 endClip = matchStr.length;
                  		 for (i=0; i<allOptions.length; i++)
                  			{
                  			 if (matchStr == allOptions[i].slice(0,endClip).toLowerCase())
                  				{smartOptions[n++] = allOptions[i]}
                  			}
                  		isForm.isList.length = 1;
                  		for (i=0; i<smartOptions.length; i++)
                  			{
                  		 	 isData = new Option(smartOptions[i],smartOptions[i]);
                  		 	 isForm.isList.add(isData,isForm.isList.options.length); 
                  			}
                  		if (smartOptions.length > 5){isForm.isList.size=6}
                  		else {isForm.isList.size = smartOptions.length+1}
                  		}
                  	if (matchStr == ""){init()}
                  }
                  
                  function getChoice(isChoice){
                  
                  	alert(isChoice);
                  }
                  
                  function init(){
                  
                  	isForm = document.forms.Form1;
                  	isForm.isList.length = 1;
                  	isForm.isList.size = 1;
                  	allOptions.sort();
                  	for (i=0; i<allOptions.length; i++)
                  		{
                  		 isData = new Option(allOptions[i],allOptions[i]);
                  		 isForm.isList.add(isData,isForm.isList.options.length); 
                  		}
                  	isForm.isText.focus();
                  }
                  
                  window.onload=init;
                  
                  </Script>
                  </Head>
                  <Body>
                  <Form name='Form1'>
                  <Table align='center' cellspacing='0' cellpadding='2' style='border:solid black 1px;font-family:Arial;font-weight:bold;font-size:12pt;width:200px;height:110px;background-color:lightyellow'>
                  <THead>
                  <TR><TH colspan='2' height='25' bgcolor='lightblue'>Name List</TH></TR>
                  </THead>
                  <TBody>
                  <TR>
                  <TD align='right' style='font-size:11pt'>Trim At:</TD>
                  <TD><input type='text' name='isText' size='15' onkeyup="buildSmartOptions(this.form)"></TD>
                  </TR>
                  <TR>
                  <TD align='center' colspan='2'>
                  <Select name='isList' onchange="getChoice(this.value)" style='width:151px'>
                  <option selected value='null'>Make a Selection</option>
                  </Select>
                  </TD>
                  </TR>
                  </TBody>
                  </Table>
                  </Form>
                  </Body>
                  </HTML></body>
                  
                  </html>
                  

                    Hi lila,

                    You could run the options from the data.

                    What you would do is something like:

                    $result = mysql_query("select * from GENUSTABLE order by GENUSNAME");
                    $i=0;
                    while($row=mysql_fetch_array($result))
                      {
                       $optionlist .= "allOptions[$i] = \"$row[GENUSNAME]\";
                       ";
                      $i++;
                      }
                    

                    and then echo the variable $optionlist at th elocation of your script, where you need the options defined.

                    Hope it works for you,

                    J.

                      Write a Reply...