How to validate forms in Magento 2 for custom module
<p>I am creating simple custom module for user details in magento 2. It has form with three fileds. I want to validate the that data before I submit. How to achieve this in magento 2? Default magento validators are not working like data-validate={}... Do I have to add any additional js files for validation?</p>

<p>helloworld.phtml file</p>

<pre><code>&lt;form class="form create account form-create-account"   action="&lt;?php echo $block-&gt;getFormAction() ?&gt;" method="post" enctype="multipart/form-data"  data-mage-init='{"validation":{}}'&gt;
    &lt;fieldset class="fieldset create account" data-hasrequired="&lt;?php /* @escapeNotVerified */ echo __('* Required Fields') ?&gt;"&gt;
        &lt;legend class="legend"&gt;&lt;span&gt;&lt;?php /* @escapeNotVerified */ echo __('Customer Information') ?&gt;&lt;/span&gt;&lt;/legend&gt;&lt;br&gt;
        &lt;div class="field required"&gt;
            &lt;label for="email_address" class="label"&gt;&lt;span&gt;&lt;?php /* @escapeNotVerified */ echo __('Email') ?&gt;&lt;/span&gt;&lt;/label&gt;
            &lt;div class="control"&gt;
                &lt;input type="email" name="email" autocomplete="email" id="email_address" value="" title="&lt;?php /* @escapeNotVerified */ echo __('Email') ?&gt;" class="input-text" data-validate="{required:true, 'validate-email':true}"&gt;
            &lt;/div&gt;
        &lt;/div&gt;

        &lt;div class="field required"&gt;
            &lt;label for="First_Name" class="label"&gt;&lt;span&gt;&lt;?php /* @escapeNotVerified */ echo __('FirstName') ?&gt;&lt;/span&gt;&lt;/label&gt;
            &lt;div class="control"&gt;
                &lt;input type="text" name="firstname"  id="first" value="" title="&lt;?php /* @escapeNotVerified */ echo __('Email') ?&gt;" class="input-text" data-validate="{required:true}" &gt;
            &lt;/div&gt;
        &lt;/div&gt;

        &lt;div class="field required"&gt;
            &lt;label  class="label"&gt;&lt;span&gt;&lt;?php /* @escapeNotVerified */ echo __('LastName') ?&gt;&lt;/span&gt;&lt;/label&gt;
            &lt;div class="control"&gt;
                &lt;input type="text" name="lastname"  id="first" value="" title="&lt;?php /* @escapeNotVerified */ echo __('LastName') ?&gt;" class="input-text" &gt;
            &lt;/div&gt;
        &lt;/div&gt;

        &lt;button type="submit" class="action submit primary" &lt;span&gt;&lt;?php /* @escapeNotVerified */ echo __('Submit') ?&gt;&lt;/span&gt;&lt;/button&gt;

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