I need to change the value of the maxinput field in the knockoutjs template vendor\magento\module-ui\view\base\web\templates\form\element\input.html so I have to replace the template with my own template loaded from my module app\code\Company\Base\view\base\web\templates\form\element\input.html.

So I created a requirejs-config.js file in my module and tried to override the original knockoutjs file:


var config = {
    map: {
        '*': {

...then I cleared the cache, but it is still loading the original template instead of mine.

  • Shouldn't that be template instead of templates? Aug 31, 2022 at 9:36
  • No, it is templates
    – Black
    Sep 1, 2022 at 11:04

1 Answer 1


I solved it by using a mixin to (mix-in my code)/(extend the code of) Magento_Ui/js/form/element/abstract.js to replace the value of elementTmpl to make it load my own template.


 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
<input class="admin__control-text" type="text"
        event: {change: userChanges},
        value: value,
        hasFocus: focused,
        valueUpdate: valueUpdate,
        attr: {
            name: inputName,
            placeholder: placeholder,
            'aria-describedby': noticeId,
            id: uid,
            disabled: disabled,
            maxlength: 512


Note: You can also place requirejs-config.js to app\code\Company\Base\view\adminhtml\, this works as well.

var config = { 
    config: {
        mixins: {
            'Magento_Ui/js/form/element/abstract': {
                'Company_Base/js/form/element/abstract-ext': true


define(['ko'], function(ko) {
    'use strict';

    return function (Abstract) {
        return Abstract.extend({
            defaults: {
                elementTmpl: "Company_Base/form/element/input"

            initialize: function() {

                return this;

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.