2

when I add color picker to admin system configuration i got this kind of error can any one know about how can I rsolve it.enter image description here

0

2 Answers 2

5

As per your error you want to add adminhtml_system_config_edit.xml on path Vendor/Module/view/adminhtml/layout/adminhtml_system_config_edit.xml in your module and add below code:

<?xml version="1.0" encoding="UTF-8"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-2columns-left"
      xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <css src="jquery/colorpicker/css/colorpicker.css"/>
    </head>
</page>

if you used <link src="jquery/colorpicker/js/colorpicker.js"/> on head tag on above file then remove it.

then run the basic CLI commands and check.

0

As per magento 2 standards, you will required requirejs-config.js to add custom javascript Create requirejs-config.js in app/code/vendor/module-name/view/adminhtml/requirejs-config.js

    var config = {
map: {
    '*': {
        customscript:'Vendor_ModuleName::js/custom'
    }
}

};

then create custom.js : app/code/Vendor/modulename/view/adminhtml/web/js

Your Answer

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

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