Dear Team,
Greetings..
I am using bootstrapvalidator with one of my PHP form and its working fine for me. The i added remote functionality in one of my field to check either the value exists in the databases or not. I am also able to achieve that. if the value already exists I am getting a warning text and if not i m not getting any warning but if the value does not exists I can save the value in the databse. When i click on the submit button, it focus on the same text field and disabled. I am unable to find out the cause for that??
Below is the code for that particular field
.bootstrapValidator({
message: 'This value is not valid',
live: 'enabled',
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
hotel_name: {
//verbose: false,
validators: {
stringLength: {
min: 3,
max: 20,
message: 'The hotel name must be more than 3 and less than 20 characters long'
},
notEmpty: {
message: 'The hotel name is required and can\'t be empty'
},
remote: {
type: 'POST',
url: 'php/Validation-hotel.php',
data: function(validator) {
return {
type: $('[name="hotel_name"]').val()
};
},
message: 'The hotel name already exists'
}
}
}, submitHandler:submitForm
}); function submitForm(){
// validator is the BootstrapValidator instance
// form is the jQuery object present the current form
//var data = $("#form_add_hotel").serialize();
$('input[type="submit"]').prop('disabled', false);
if($('#standard-icon').hasClass("glyphicon-ok") || $('#premimum-icon').hasClass("glyphicon-ok") || $('#executive-icon').hasClass("glyphicon-ok")){
alert('hi');
$.post('php/common.php?action=hotel_generalinfo', {hotel_name: hotel_name},
function(info){
$("#validate_msg").html(info).addClass('validatectrl');
clear_fields();
});
alert('After');
}else{
alert('Please select room type!');
}
}