⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Bootstrap theme error message



Sanaa Alauddin Khan

Sanaa Alauddin Khan
  • profile picture
  • Member

Posted 08 August 2015 - 04:28 AM

Hi all, Is it possible to change the placemnet of the error messages in the add form? Also is there a possibility to use live validation?


Sanaa Alauddin Khan

Sanaa Alauddin Khan
  • profile picture
  • Member

Posted 26 August 2015 - 02:59 AM

well i added formvalidation code to the add file in view folder. and it works!! now i can see the errors as tooltip.. soooo happy!!!!


Kobus

Kobus
  • profile picture
  • Member

Posted 26 August 2015 - 13:25 PM

Well done! Would like to see how you did it.


Sanaa Alauddin Khan

Sanaa Alauddin Khan
  • profile picture
  • Member

Posted 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>

Sanaa Alauddin Khan

Sanaa Alauddin Khan
  • profile picture
  • Member

Posted 28 August 2015 - 03:30 AM

Heres a screenshot of it

[attachment=1002:Screen Shot 2015-08-27 at 11.28.13 PM.png]