0

In frontend I've managed to add a form that loads in a modal shown after a product is added to cart. On that form a field must have a calendar on. I've used the attribute data-mage-init='{"calendar": {"showTime": false, "showOn":"both", "defaultDate":"-20y"}}' on the form field. But on the console I see

"NetworkError: 404 Not Found - http://testmagento2/pub/static/frontend/Magento/luma/en_US/calendar.js" .

Indeed in that location there is no calendar.js. Instead I've found the calendar.js under http://testmagento2/pub/static/frontend/Magento/luma/en_US/mage/calendar.js

I can't figure out the problem. Any help is appreciated! Thank you in advance!

Vishwas Soni
1,56714 silver badges34 bronze badges
asked Dec 18, 2015 at 8:10

1 Answer 1

2

ok... so the last idea I came up with was to include the following script inside .phtml file, and not use the data-mage-init attribute anymore:

<form action="" method="POST">
 <label for="name">Name: </label>
 <input type="text" id="name" name="name"/><br>
....
 <label for="birthdate">Birth date: </label>
 <input type="text" id="birthdate" name="birthdate"/><br>
</form>
 <script>
 require([
 "jquery",
 "mage/calendar"
 ], function($){
 $("#birthdate").calendar({
 showTime: false,
 //dateFormat: "yy-mm-dd"
 });
 });
 </script>
answered Dec 18, 2015 at 9:54

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.