HTML form with custom function call
<p>I am developing Universal windows 8.1 app and I have a page for creating new contact.
In purpose to validate input fields I put them in form. My form action not supposed to go to service it just need to validate fields and call custom function.</p>

<p>HTML:</p>

<pre><code>&lt;form name="myform" onSubmit="JavaScript:OnSubmitForm()"&gt;
     &lt;div&gt;
         &lt;label&gt;
             First name&lt;br /&gt;
             &lt;input id="contactFirstName" class="win-textbox" type="text" name="firstName" required /&gt;
         &lt;/label&gt;
     &lt;/div&gt;
     &lt;div&gt;
         &lt;label&gt;
             Last name&lt;br /&gt;
             &lt;input id="contactLastName" class="win-textbox" type="text" name="lastName" /&gt;
         &lt;/label&gt;
     &lt;/div&gt;
     &lt;input type="submit" value="Submit"/&gt;
     &lt;input type="button" value="Cancel"/&gt;
&lt;/form&gt;
</code></pre>

<p>JavaScript:</p>

<pre><code>document.addEventListener('DOMContentLoaded', function() {
    function OnSubmitForm()
    {
        alert('click');
    }
});
</code></pre>

<p>My alert is never calls in plain HTML project neither in WinJS app. I also tried with:</p>

<pre><code>  &lt;form name="myform" onsubmit="return OnSubmitForm();"&gt;
</code></pre>

<p>and the same.</p>

<p>Does it a good approach at all, to use form just for input fields validation or there is better way, and why this does not work ?</p>