Rajnikant Bajpai
Rajnikant Bajpai

Reputation: 47

jquery min form-error class hides my form control after model validation in cakephp

I am using cakephp 3.6,with bootstrap theme and jquery form validation.

But i am facing some issues with my form textbox controls.

After submitting the form,It display model validation in the form fields. but when i try to correct form data and change my cursor, it hides the textbox from form.

I debug lots and find it applies form-error class in my inputs.

but i don't no how to prevent or from where it comes and where its style resides. enter image description here Please help me to resolve this.

Before form submit

 <div class="form-group">
    <label class="col-sm-2 control-label">Password<span class="text-danger">*</span></label>
        <div class="col-sm-10">
            <?= $this->Form->control('old_password',
                [
                    'placeholder' => 'Old Password',
                    'id'=>'oldpass',
                   'type'=>'password',
                    'label'=>false,
                    'class'=>'form-control',
                    'data-validation'=>"required"                                      
                ]
            ) ?>
            </div>
        </div>

After form submit

<div class="form-group">
<label class="col-sm-2 control-label">Password<span class="text-danger">*</span></label>
    <div class="col-sm-10">
        <?= $this->Form->control('old_password',
            [
                'placeholder' => 'Old Password',
                'id'=>'oldpass',
               'type'=>'password',
                'label'=>false,
                'class'=>'form-control form-error',
                'data-validation'=>"required"                                      
            ]
        ) ?>
        </div>
    </div>

Upvotes: 0

Views: 47

Answers (1)

Rajnikant Bajpai
Rajnikant Bajpai

Reputation: 47

I fix this with below given solution.

$(document).ready(function(){
       $('.form-control').removeClass('form-error');
});

Upvotes: 0

Related Questions