validationtabsformvalidation-plugin

jQuery FormValidation don't work inside of Bootstrap multi tab


I have a problem with FormValidation to validate a form in multi-tab (Bootstrap theme).When I click on submit button in #tab-1, formValidation work correctly. but when I change to #tab-2 or #tab-3, field validation in #tab-1 don't work and submit form without validation.

<form id="newstext" method="post" class="form-horizontal"
    data-fv-framework="bootstrap"
    data-fv-message="This value is not valid"
    data-fv-icon-valid="glyphicon glyphicon-ok"
    data-fv-icon-invalid="glyphicon glyphicon-remove"
    data-fv-icon-validating="glyphicon glyphicon-refresh">
<div class="tabbable">
  <ul class="nav nav-tabs">
        <li class="active"><a href="#tab-1" data-toggle="tab"><i class="green ace-icon fa fa-home bigger-120"></i>tab-1</a></li>
        <li><a href="#tab-2" data-toggle="tab"><i class="red ace-icon fa fa-folder bigger-120"></i>tab-2</a></li>
        <li><a href="#tab-3" data-toggle="tab"><i class="blue ace-icon fa fa-exchange bigger-120"></i>tab-3</a></li>
  </ul>
  <div class="tab-content">
        <div class="tab-pane active" id="tab-1">
            <div class="panel-body">
                <div class="col-md-6">
                    <div class="form-group">

                            <label class="control-label">title *</label> 
                            <input id="title" name="title" type="text" placeholder="" class="form-control"
                            data-fv-notempty="true"
                            data-fv-notempty-message="The title is required" />
                    </div>
                    <div class="form-group">

                            <label class="control-label">abstract </label> 
                            <input id="abst" name="abst" type="text" placeholder="" class="form-control">

                    </div>
                </div>  
            </div>      
        </div>

        <div class="tab-pane" id="tab-2">
            <div class="panel-body">
                <div class="col-md-6">
                    <div class="form-group">

                            <label class="control-label">name</label> 
                            <input id="namee" name="namee" type="text" placeholder="" class="form-control">

                    </div>
                </div>  
            </div>
        </div>

        <div class="tab-pane" id="tab-3">
            <div class="panel-body">
                <div class="col-md-6">
                    <div class="form-group">
                        <label class="control-label">show</label> 
                        <input name="show_callme" value="1" id="show_callme" type="checkbox">Ok
                        <input name="show_callme" value="1" id="shows" type="checkbox">Bold
                    </div>
                </div>  
            </div>
        </div>

        <br>
        <button type="submit" class="btn btn-success">submit</button>
    </div>
</div>

Please see my code in Codepen


Solution

  • This example might be helpful: formvalidation.io/examples/bootstrap-tab

    JQuery FormValidation Has solved the problem Validation That by replacing the jquery, validation between tabs work