Skip to content

On validation prevent calender control to open

I want to prevent open calendar control on save button at time of validation fire , I am not able to find how can I prevent It

I have one calendar control in form , select date validation fire on save button after validation it will direct focus on calendar control and open calendar automatically , business don’t want to open calendar control


<div class="col-lg-3 col-md-4 col-sm-6">
           <div class="form-group datepicker">
                   <label>Project Start Date </label>
                       <asp:TextBox ID="ProjectStartDate" TabIndex="27" ClientIDMode="Static" runat="server" CssClass="form-control"></asp:TextBox>
                        <asp:HiddenField ID="hdnProjectStartDate" runat="server" Value="" />

enter image description here

I want to prevent open calendar open on save button
let me know if any solution over there

Thank you


I have solve this issue to change in formValidation.JS
In this file there is one function

      // Determined the first invalid field which will be focused on automatically
        var ns = this._namespace;
        for (var i = 0; i < this.$invalidFields.length; i++) {
            var $field    = this.$invalidFields.eq(i),
                autoFocus = this.isOptionEnabled($field.attr('data-' + ns + '-field'), 'autoFocus');
            if (autoFocus) {
                // Focus the field
                return false;

On validation it will auto focus that element & after focus calendar control will open automatically because of focus

Comment this line for prevent focus on calendar control


Thank you !!