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: MDBDatePicker no Validation

sandor farkas priority asked 2 years ago


Expected behavior MDBDatepicker should be working with MDBValidationItem

Actual behavior MDBDatepicker not validated

Resources (screenshots, code snippets etc.)

MDBDatepicker does not work in the snippet: https://mdbootstrap.com/snippets/react/sandorfarkas/3925733

Please put MDBValidation around and you'll see no validation happening:

<MDBValidation>
     <MDBValidationItem feedback='Please provide us a valid date' invalid>
                      <MDBDatepicker format='dd, mm, yyyy' inputLabel={'When did the situation happen?'} required />
                    </MDBValidationItem>
</MDBValidation>

Thank you



You have to pass the required property in a different way:

        <MDBValidation>
          <MDBValidationItem feedback='Please provide us a valid date' invalid>
            <MDBDatepicker
              format='dd, mm, yyyy'
              inputLabel={'When did the situation happen?'}
              inputProps={{ required: true }}
            />
          </MDBValidationItem>

          <MDBBtn className='mt-4' type='submit'>submit</MDBBtn>
        </MDBValidation>


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 React
  • MDB Version: MDB5 3.0.0
  • Device: desktop
  • Browser: chrome
  • OS: windows 11
  • Provided sample code: No
  • Provided link: Yes