0

I've created a module which extends the magento 2 checkout, where I've added another field according with the magento documentation: http://devdocs.magento.com/guides/v2.0/howdoi/checkout/checkout_form.html

This has worked and they are displayed on the frontend, however the validation causes a weird error. If I use:

<item name="validation" xsi:type="array"> <item name="required-entry" xsi:type="string">true</item> </item>

As per the documentation, the field shows an asterisk (showing this is a required field), however upon submitting the form the error doesn't display and it doesn't prevent the form submitting.

4
  • have you recompile? – chirag Nov 14 '16 at 13:02
  • setup:di:compile ? – ol'bob dole Nov 14 '16 at 13:05
  • yes, bin/magento setup:di:compile – chirag Nov 14 '16 at 13:17
  • I've re-run it and it's had no affect – ol'bob dole Nov 14 '16 at 15:00
0

May be this will help you.

<item name="telephone" xsi:type="array">
   <item name="config" xsi:type="array">
      <item name="tooltip" xsi:type="array">
         <item name="description" xsi:type="string" translate="true">For delivery questions.</item>
      </item>
   </item>
   <!-- add a validation code at here -->
   <item name="validation" xsi:type="array">
     <item name="validate-digits" xsi:type="string">true</item>
   </item>
   <!-- end of validation -->
</item>

you can also refer this url.

if not work let me know.

3
  • Thanks for your help. This actually doesn't produce anything at all in my module. Just to confirm it wasn't caching, I reverted back to my previous xml and that displayed. – ol'bob dole Nov 16 '16 at 10:31
  • ohhh.. take care next time. – chirag Nov 16 '16 at 10:33
  • Sorry, you misunderstand - my previous xml still fails to validate but it does display a field. Yours doesn't display a field. – ol'bob dole Nov 16 '16 at 11:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.