Amelia Prefill Custom Fields

 Booking Form 1.0

class AmeliaPrefillCustomFields {


    constructor() {

      if (document.querySelector(".amelia-booking")) {

        this.events();

      }

    }

    events() {

      window.beforeConfirmBookingLoaded = function () {

        var postField = document.querySelector(

          "#am-confirm-booking .am-custom-fields .el-form-item .el-input__inner"

        );

        postField.disabled = true;

        postField.style.color = "#84868a";

        postField.style.backgroundColor = "#f5f5f5";

        postField.style.opacity = "0.7";

        postField.value = localized_data.marke + " " + localized_data.modell;

        postField.dispatchEvent(new Event("input"));

      };

    }  

}

Booking Form 2.0

  class AmeliaPrefillCustomFields {
    constructor() {
      if (document.querySelector("#amelia-v2-booking-1000")) {
        this.events();
      }
    }
        
    events() {
        window.ameliaActions = {
            InitInfoStep: function (success = null, error = null, data) {
                
                data.booking.customFields[1].value = localized_data.marke + " " + localized_data.modell;

                document.querySelector(".el-form .el-form-item:nth-last-child(3) .el-input__inner").disabled = true;
            }
        }
    }
}