@
php_rocs
The form is:
Code:
<form action="<?php echo site_url('contact/contact_form'); ?>" method="post" id="testform">
<br /><br />
<div class="card">
<div class="card-header">Personal Info</div>
<div class="card-body">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<small class="form-text text-muted">First Name</small>
<?php echo form_input(array('class'=>'form-control', 'id'=>'first_name', 'name'=>'first_name'));?>
</div>
<small class="form-text text-muted">Gender</small>
<div class="form-group">
<?php echo form_dropdown('gender', array('Male'=>'Male', 'Female'=>'Female'), 'Male', 'class="form-control" id="gender"');?>
</div>
<div class="form-group">
<small class="form-text text-muted">Email</small>
<?php echo form_input(array('class'=>'form-control', 'id'=>'email', 'name'=>'email'));?>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<small class="form-text text-muted">Last Name</small>
<?php echo form_input(array('class'=>'form-control', 'id'=>'last_name', 'name'=>'last_name','size'=>25));?>
</div>
<div class="form-group">
<small class="form-text text-muted">Phone</small>
<?php echo form_input(array('class'=>'form-control', 'id'=>'phone', 'name'=>'phone', 'size'=>25));?>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<button type="submit" name="submit" class="btn btn-primary pull-left">Submit Form</button>
</div>
</div>
</form>
and the validation is
Code:
// Form Validation
$('#testform').bootstrapValidator({
message: 'This value is not valid',
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
first_name: {
message: 'The username is not valid',
validators: {
notEmpty: {
message: 'The username is required and cannot be empty'
},
stringLength: {
min: 6,
max: 30,
message: 'The username must be more than 6 and less than 30 characters long'
},
regexp: {
regexp: /^[a-zA-Z0-9_]+$/,
message: 'The username can only consist of alphabetical, number and underscore'
}
}
},
email: {
validators: {
notEmpty: {
message: 'The email is required and cannot be empty'
},
emailAddress: {
message: 'The input is not a valid email address'
}
}
}
}
});
});
When I update the email field, then the form can be submitted.