Element's Value is Null - I am not representing this correctly, I think
<p>Here's my code - I am getting an error in my firebug console that document.getElementById('deletebutton').value is null.</p>

<p>EDIT: To explain what I want - I want code to execute if one of two submit buttons is pressed - this is code to determine whether it was the delete button that was pressed (if not, it should have a null value) and it will execute certain code. Whenever I try to use this though, I keep getting the error message "'deletebutton' is null.</p>

<p>Here's the HTML:</p>

<pre><code>&lt;button type="submit" name="del" id="deletebutton" value="'.$org.'"&gt;Delete&lt;/button&gt;
</code></pre>

<p>How do I account in my program for this? I set it to '', but I believe null would be a better option. Would I do:</p>

<pre><code>if (document.getElementById('deletebutton').value != null
</code></pre>

<p>?</p>

<p>Here's the actual code:</p>

<pre><code>&lt;script type="text/javascript"&gt;
    //&lt;![CDATA[

function formValidation() {

var ids = ["orgname", "cultpicklist", "catpicklist", "servpicklist"]
    formValue = 1;

    if (document.getElementById('deletebutton').value != '' &amp;&amp; document.getElementById('orgname').value === "") {
      formValue = 0;
    }
else {
for (var i = 0, len = ids.length; i &lt; len; i++) {
    if (document.getElementById(ids[i]).value === "") {
       formValue = 0;
       break;
    }
}
}

 if (formValue == 1) {
           return true;
      } else if (formValue == 0) {
           alert('Please fill out all required fields');
           return false;
      }
}
//]]&gt;
    &lt;/script&gt;
</code></pre>
