document.forms.gallery_form.submit is not a function
<p>I swear, I have this exact thing working on another page. I'm such a javascript noob it's embarrassing...</p>

<pre><code>function delete_gallery() {
    var gallery = document.getElementById('gallery_id').value;
    var form = document.getElementById('gallery_form');
    form.setAttribute('action', 'index.php?action=delete&amp;section=galleries&amp;id='+gallery);
    document.forms['gallery_form'].submit();
}
</code></pre>

<p>Inspecting the element shows that it's updating the action correctly :</p>

<pre><code>&lt;form method="post" action="index.php?action=delete&amp;amp;section=galleries&amp;amp;id=12" name="gallery_form" id="gallery_form"&gt;&lt;input type="hidden" value="12" id="gallery_id" name="gallery_id"&gt;&lt;p&gt;Name: &lt;input type="text" name="name" value="Woo"&gt;&lt;/p&gt;&lt;p&gt;Description:&lt;br&gt;&lt;textarea name="description"&gt;Dee&lt;/textarea&gt;&lt;input type="hidden" value="2" name="artist"&gt;&lt;/p&gt;&lt;p&gt;&lt;input type="submit" value="Submit" name="submit"&gt;
    &lt;/p&gt;&lt;/form&gt;
</code></pre>

<p>Here's the button I use to call the function, it's in a table below the form:</p>

<pre><code>&lt;button onclick="delete_gallery()" type="button"&gt;Delete Gallery&lt;/button&gt;
</code></pre>

<p>EDIT:</p>

<p>I should have mentioned I tried using the getElementById method first, ala forms.submit(); - I had the same error, which is why I switched to using document.forms[] instead.</p>
