Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: Disable Angular mdb-datepicker

Declan Ward priority asked 1 year ago


Expected behavior Disable complete control, input and datepicker

Actual behavior Input disabled but date-picker-toggle is still enabled allowing the selection of a date which then displays in the input box.

Resources (screenshots, code snippets etc.)

enter image description here

                <mdb-form-control>
                  <input
                    mdbInput
                    [mdbDatepicker]="registrationDate"
                    type="text"
                    formControlName="registrationDate"
                    class="form-control"
                  />
                  <label mdbLabel for="registrationDate" class="form-label">First Registration date</label>
                  <mdb-datepicker-toggle [mdbDatepicker]="registrationDate"></mdb-datepicker-toggle>
                  <mdb-datepicker 
                    [inline]="true" #registrationDate                                     
                  ></mdb-datepicker>
                </mdb-form-control>

Rafał Seifert free answered 1 year ago


<mdb-datepicker-toggle> has disabled input. You can set it to true to disable the toggle like so:

    <mdb-form-control>
      <input
        mdbInput
        [mdbDatepicker]="registrationDate"
        type="text"
        formControlName="registrationDate"
        class="form-control"
      />
      <label mdbLabel for="registrationDate" class="form-label">First Registration date</label>
      <mdb-datepicker-toggle
        [disabled]="true"
        [mdbDatepicker]="registrationDate"
      ></mdb-datepicker-toggle>
      <mdb-datepicker [inline]="true" #registrationDate></mdb-datepicker>
    </mdb-form-control>

ammi pro commented 1 year ago

add [disabled]="registrationDate.disabled" to mdb-datepicker-toggle



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB Angular
  • MDB Version: MDB5 4.0.0
  • Device: Desktop
  • Browser: All
  • OS: Windows
  • Provided sample code: No
  • Provided link: No