Note that there are some explanatory texts on larger screens.

plurals
  1. POonKeyUp function not returning all results
    primarykey
    data
    text
    <p>Background - I have a form with a text field. The user enters 2-6 digit integers. On each key stroke, the javascript function is called matching up values from a dropdown. </p> <p>My text field:</p> <pre><code>&lt;input type="text" name="orgSICCode" value="" allownull="FALSE" size="5" maxlength="10" datatype="dtNumeric" onKeyUp="ActivateOption(description,this.value);" onBlur="this.value = description.options[description.selectedIndex].value;" emsg="Must choose a SIC Code before you can continue."&gt; </code></pre> <p>My dropdown field:</p> <pre><code> &lt;select name="description" STYLE="width:275px;" onChange="orgSICCode.value = this.options[this.selectedIndex].value;sic_code_description.value = this.options[this.selectedIndex].text;"&gt; &lt;option value=""&gt;Select One ...&lt;/option&gt; &lt;option value="085101"&gt;085101 - Forest management services&lt;/option&gt; &lt;option value="0831"&gt;0831 - Forest Products&lt;/option&gt; &lt;option value="083100"&gt;083100 - Forest products&lt;/option&gt; &lt;option value="083199"&gt;083199 - Forest products, nec&lt;/option&gt; &lt;option value="08"&gt;08 - Forestry&lt;/option&gt; &lt;/select&gt; </code></pre> <p>My javascript function ActivateOption:</p> <pre><code>function ActivateOption(selectObj, strValue) { for(var idx=0;idx&lt;selectObj.options.length;idx++) { if(selectObj.options[idx].value.substring(0,strValue.length) == strValue) { selectObj.selectedIndex = idx; return true; } } selectObj.selectedIndex = 0; return false; } </code></pre> <p>When a user types '08', the first option that should populate is the 08 value, "08 - Forestry" option. The option that does populate is '085101', '085101 - Forest Management services'.</p> <p>Am I doing something wrong?</p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload