I have a form that is generated through a .phtml
file, and in this form various fields are loaded with KnockOut (using the uiComponent
javascript-object).
.phtml
:
<form action="#" class="form checkout__account" method="post" data-mage-init='{"validation":{}}'>
<?php echo $block->getBlockHtml('formkey'); ?>
<fieldset class="fieldset" data-bind="scope:'vendor_module_account'">
<!--
Account form:
-->
<!-- ko template: getTemplate() --><!-- /ko -->
</fieldset>
</form>
.html
(which is inserted in ko template: getTemplate()
):
<input type="text" name="login[username]" id="email" class="input-text required-entry"
data-validate="{required:true, 'validate-email':true}"
data-bind="event:{change:checkEmailAddress,blur:checkEmailAddress,keypress:absorbEnter},value:emailAddress" />
Now I can get it why this wouldn't directly work on blur, but also when I submit the form (Using the inspector $0.submit()
) the validation doesn't get executed.
Another interesting detail: the form gets an attribute novalidate="novalidate"
added, I guess by the data-mage-init
-attribute.
Anyone know why my form isn't validated and/or what I have to do is make it validate on submit/blur?