Forums

Forums / Developing Portals / Date time field how to set custom validation

Date time field how to set custom validation

Thread is closed for posting
3 posts, 1 answered
  1. Krishna Hari
    Krishna Hari avatar
    65 posts
    Registered:
    05 Dec 2019
    05 Feb 2020
    Link to this post
    We have a date filed which has a custom format MM/dd/yyyy. I want to know how to make sure i can not type in invalid date. right now its letting me type anything
  2. Omar S
    Omar S avatar
    51 posts
    Registered:
    04 Jul 2019
    Answered
    07 Feb 2020 in reply to Krishna Hari
    Link to this post
    Hi Krishna

    You can make the input readonly so that the user cannot enter any date through the keyboard. Instead, the user has to use the UI buttons to pick a date. This can be done by adding the following custom Jquery on the page: 

    $(".k-datepicker").find('span').find('input').attr("readonly", "readonly");

    Also another thing, if you set the date to required, it will not allow the user to submit incorrectly formatted dates or dates outside the range you preset 
    Last modified on 07 Feb 2020 19:02 by Omar S
  3. Patrick
    Patrick avatar
    33 posts
    Registered:
    20 Apr 2020
    21 Apr 2020
    Link to this post
    Hi Krishna,

    I trust that Omar's recommendations worked for you. If you need any further assistance with your date field configuration, feel free to create another forum thread or contact TPC Support at support@crmportalconnector.com.

    Thanks,

    Patrick
3 posts, 1 answered