HTML Form method="post"
<p>I am trying to understand an existing piece of software, and have come accross the following:</p>

<pre><code>&lt;form name="AppForm" method="post" enctype="multipart/form-data" action="" onsubmit="return fnPreSubmit()"&gt;

&lt;input id="submit" type="submit" value="Apply now"/&gt;

&lt;/form&gt;
</code></pre>

<p>On the screen there is a button with the text "Apply Now", and From what I understand, the <code>input</code>tags of the HTML create this button.</p>

<p>I am trying to understand what happens in the code when the button is pressed.</p>

<p>Previously, when I have used forms, <code>action</code> has had a value, for example a page name, so I could work out where the code was going. </p>

<p>In this case, <code>action</code> does not have a value. From searching on the internet, it seems this means the form is being submitted to the same page.</p>

<p>My question is, how can I tell where on the page the code is being submitted to? Or, to put it another way, how can I work out what is going on with the code after the button has been pressed?</p>

<p>Is it the case that the page is reloaded again, and all the data that has been filled out in the form is posted to the page and the page loads with that data already loaded?</p>

<p>Here is the JS method fnPreSubmit and any related methods. It seems to me these validate the form before it posts back to the same page?</p>

<pre><code>    function fnPreSubmit()
    {
        var oFrm = document.forms['AppForm'];

        // First set any disable inputs back to enabled so that the value gets sent
        for (var ii = 0; ii &lt; arrROC.length; ii++)
        {
            var oReadOnlyInput = oFrm[arrROC[ii][0]];
            if (oReadOnlyInput.disabled)
            {
                oReadOnlyInput.disabled = false;
            }
        }

        // Sort out the date fields
        fnProcessDateFields(oFrm);

        dataLayer.push({'event': 'ApplicationSubmit'});

        return true;
    }

    function fnProcessDateFields(pFrm)
    {
        var sName = "";

        if (pFrm['datefield'] != undefined)
        {
            for (var ii = 0; ii &lt; pFrm['datefield'].length; ii++)
            {
                sName = pFrm['datefield'][ii].value;

                pFrm[sName].value = pFrm['date_dd_' + sName].value + '/' + pFrm['date_mm_' + sName].value + '/' + pFrm['date_yyyy_' + sName].value;
            }               
        }
    }
</code></pre>