Ryan Salmons
Ryan Salmons

Reputation: 1459

Jquery Validation plugin not validating entire form

I am trying to validate a form with the jQuery validation plugin. However, I am only getting the validation to work for 1 of the inputs. Any ideas?

<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.js">     </script>

 <form id="driver-form" class="form-horizontal driver" method="post">
        <div class="form-group">
            <label for="inputName1" class="col-md-2 col-md-offset-2 control-label">First Name</label>
            <div class="col-md-4">
            <input type="text" class="form-control" id="driverFirst" placeholder="First Name" required/>
            </div>
        </div>
        <div class="form-group">
            <label for="driverLast" class="col-md-2 col-md-offset-2 control-label">Last Name</label>
            <div class="col-md-4">
            <input type="text" class="form-control" id="driverLast" placeholder="Last Name" required/>
            </div>
        </div>
        <div class="form-group">
            <label for="inputEmail1" class="col-md-2 col-md-offset-2 control-label">Email</label>
            <div class="col-md-4">
            <input type="email" class="form-control" id="driverEmail" placeholder="Email" required/>
            </div>
        </div>
        <div class="form-group">
            <label for="inputPhone1" class="col-md-2 col-md-offset-2 control-label">Phone Number</label>
            <div class="col-md-4">
            <input type="text" class="form-control" id="driverPhone" placeholder="Phone Number" required/>
            </div>
        </div>

    </form>

javascript:

 $("#driver-form").validate();

jsfiddle: http://jsfiddle.net/rynslmns/533Yt/

Upvotes: 0

Views: 294

Answers (1)

Arun P Johny
Arun P Johny

Reputation: 388446

The validation framework used name attribute, you have not specified it

<input type="text" class="form-control" id="driverFirst" name="driverFirst" placeholder="First Name" required/>

Demo: Fiddle

Upvotes: 1

Related Questions