Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Form validation attributes #16

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 30 additions & 21 deletions view/frontend/templates/customer/lookupform.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -5,51 +5,60 @@
* https://www.magepal.com | [email protected]
*/

/** @var $block MagePal\GuestToCustomer\Block\Customer\LookupForm */
/** @var $escaper \Magento\Framework\Escaper */
/** @var $block MagePal\GuestToCustomer\Block\Customer\LookupForm */
?>

<form class="form form-edit-account" action="<?= $block->escapeUrl($block->getUrl('customer/guesttocustomer/lookupformPost')) ?>" method="post" id="form-validate" data-hasrequired="<?= $block->escapeHtmlAttr(__('* Required Fields')) ?>" autocomplete="off">
<form class="form form-edit-account"
action="<?= $escaper->escapeUrl($block->getUrl('customer/guesttocustomer/lookupformPost')) ?>"
method="post"
id="form-validate"
data-mage-init='{"validation": {}}'
data-hasrequired="<?= $escaper->escapeHtmlAttr(__('* Required Fields')) ?>"
autocomplete="off">
<fieldset class="fieldset info">
<?= $block->getBlockHtml('formkey') ?>
<legend class="legend"><span><?= $block->escapeHtml(__('Guest Order Information')) ?></span></legend><br>
<legend class="legend"><span><?= $escaper->escapeHtml(__('Guest Order Information')) ?></span></legend><br>
<div class="field field-order-increment required">
<label class="label" for="order-increment">
<span><?= __('Order Number') ?></span>
<span><?= $escaper->escapeHtml(__('Order Number')) ?></span>
</label>

<div class="control">
<input type="text" id="order-increment" name="order_increment" value="" title="Order Number" class="input-text required-entry" data-validate="{required:true}" aria-required="true">
<input type="text"
id="order-increment"
name="order_increment"
value=""
title="<?= $escaper->escapeHtmlAttr(__('Order Number')) ?>"
class="input-text required-entry"
data-validate="{required: true}"
aria-required="true">
</div>
</div>
<div class="field field-email required">
<label class="label" for="email">
<span><?= __('Email') ?></span>
<span><?= $escaper->escapeHtml(__('Email')) ?></span>
</label>

<div class="control">
<input type="text" id="email" name="email" value="<?= $block->escapeHtmlAttr($block->getCustomer()->getEmail()) ?>" title="First Name" class="input-text required-entry" data-validate="{required:true}" aria-required="true" disabled>
<input type="email"
id="email"
name="email"
value="<?= $escaper->escapeHtmlAttr($block->getCustomer()->getEmail()) ?>"
title="<?= $escaper->escapeHtmlAttr(__('Email')) ?>"
class="input-text"
disabled>
</div>
</div>
</fieldset>

<?= $block->getChildHtml('form_additional_info') ?>

<div class="actions-toolbar">
<div class="primary">
<button type="submit" class="action save primary" title="<?= $block->escapeHtmlAttr(__('Save')) ?>"><span><?= $block->escapeHtml(__('Save')) ?></span></button>
<button type="submit" class="action save primary" title="<?= $escaper->escapeHtmlAttr(__('Save')) ?>"><span><?= $escaper->escapeHtml(__('Save')) ?></span></button>
</div>
<div class="secondary">
<a class="action back" href="<?= $block->escapeUrl($block->getBackUrl()) ?>"><span><?= $block->escapeHtml(__('Go back')) ?></span></a>
<a class="action back" href="<?= $escaper->escapeUrl($block->getBackUrl()) ?>"><span><?= $escaper->escapeHtml(__('Go back')) ?></span></a>
</div>
</div>
</form>
<script>
require([
"jquery",
"mage/mage"
], function($){
var dataForm = $('#form-validate');

dataForm.mage('validation', {});

});
</script>