Javascript error occuring when trying to reset a 'select-one' object value
<p>I am trying to reset the values of all elements inside the form
using the following javascript function</p>

<pre><code>function doResetAction(formName)
{
        var form2 = eval("document.formNameNativ");
        var frm_elements = form2.elements;
        var count=0;
        for(i=0; i&lt;frm_elements.length; i++)  
        {   
            field_name = frm_elements[i].name.toLowerCase();
            field_type = frm_elements[i].type.toLowerCase();                    
            if(field_name == 'startofac')
            {
                count=i;        
            }
        }
        for(j=count; j&lt;frm_elements.length; j++)  
        {
            field_name = frm_elements[j].name;
            field_type = frm_elements[j].type.toLowerCase();     
            switch (field_type) {
                 case "text": 

                 if(document.getElementById(field_name).value !=null)
                        document.getElementById(field_name).value = document.getElementById(field_name).defaultValue;
                  break;            
                case "select-one":  


                if(document.getElementById(field_name).value !=null)
                        document.getElementById(field_name).value = document.getElementById(field_name).defaultValue;
                break;
              }
        }
}
</code></pre>

<p>It works fine when the type is of text but for some reason giving error for
<code>select-one</code>. Can someone help me out here
The error I am getting at <code>select-one</code> is</p>

<pre><code>Error: document.getElementById(field_name) is null
At line: 679
</code></pre>
