Jump to content


Sanaa Alauddin Khan

Member Since 20 Jul 2015
Offline Last Active Sep 15 2015 07:44 PM
-----

#13031 Bootstrap theme error message

Posted Sanaa Alauddin Khan on 28 August 2015 - 03:06 AM

I added the below code to add.php in the view folder of bootstrap theme. it uses formvalidation from http://formvalidation.io/

 

I dont know how to add images to this thread otherwise i would have included a screenshot of it too. :)

<script>
$(document).ready(function() {
$('#crudForm').formValidation({
        live:'enabled',
        feedbackIcons: {
            required: 'glyphicon glyphicon-asterisk',
            valid: 'glyphicon glyphicon-ok',
        
    invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },

        err:{container:'popover'},
	 
        fields: {
            
        degree: {
                validators: {
                    notEmpty: {
                        message: 'Degree is required'
                    }
                }
            },  
            specialization: {
                validators: {
                    notEmpty: {
                        message: 'Specialization is required'
                    }
                }
            }, 
            status: {
                validators: {
                    notEmpty: {
                        message: 'Status is required'
                    }
                }
            }, 
            college: {
                validators: {
                    notEmpty: {
                        message: 'College is required'
                    }
                }
            }, 
        address1: {
                validators: {
                    notEmpty: {
                        message: 'Address 1 is required'
                    }
                }
            },
        address2: {
            validators: {
            notEmpty: {
                message: 'Address 2 is required'
                    }
                }
            },
             city: {
                validators: {
                    notEmpty: {
                        message: 'City is required'
                    }
                }
            },
        state: {
            validators: {
            notEmpty: {
                message: 'State is required'
                    }
                }
            },
            zipcode: {
                validators: {
                    notEmpty: {
                        message: 'Zipcode is required'
                    }
                }
            },
        country: {
            validators: {
            notEmpty: {
                message: 'Country is required'
                    }
                }
            },
            company_name: {
                validators: {
                    notEmpty: {
                        message: 'Company Name is required'
                    }
                }
            },  
            title: {
                validators: {
                    notEmpty: {
                        message: 'Title is required'
                    }
                }
            }, 
            date_from: {
                validators: {
                    notEmpty: {
                        message: 'From Date is required'
                    },
                    date: {
                        format: 'MM/DD/YYYY',
                        message: 'The value is not a valid date'
                    }
                }
            }, 
            date_to: {
                validators: {
                    notEmpty: {
                        message: 'To Date is required'
                    },
                    date: {
                        format: 'MM/DD/YYYY',
                        message: 'The value is not a valid date'
                    }
                }
            }, 
        work_email: {
                validators: {
                    notEmpty: {
                        message: 'Email address is required'
                    },
                    stringLength:{
                        min:6,
                        max:35,
                        message:'Email Address must be between 6 and 35 charaters long'
                    },
                    emailAddress:{
                        message:'Email Address is invalid'
                    }
                }
            }
             
    }
})
.on('success.form.fv', function(e) {
            var $form = $(e.target);
            var fv = $form.data('formValidation');
            fv.defaultSubmit();
        });
});


</script>