Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript">
- const form = document.querySelector('#employee_create_form');
- var addValidator = FormValidation.formValidation(
- form, {
- fields: {
- 'company_id': {
- validators: {
- notEmpty: {
- message: 'Select Company'
- }
- }
- },
- 'first_name': {
- validators: {
- notEmpty: {
- message: 'First Name is required'
- }
- }
- },
- 'middle_name': {
- validators: {
- notEmpty: {
- message: 'Middle Name is required'
- }
- }
- },
- 'last_name': {
- validators: {
- notEmpty: {
- message: 'Last Name is required'
- }
- }
- },
- 'date_of_birth': {
- validators: {
- notEmpty: {
- message: 'Date Of Birth is required'
- }
- }
- },
- 'gender': {
- validators: {
- notEmpty: {
- message: 'Gender is required'
- }
- }
- },
- 'marital_status': {
- validators: {
- notEmpty: {
- message: 'Marital Status is required'
- }
- }
- },
- 'email': {
- validators: {
- notEmpty: {
- message: 'Email is required'
- },
- emailAddress: {
- message: 'The input is not a valid email address'
- },
- remote: {
- message: 'Email is already registered',
- method: 'GET',
- url: backend_url+'/users/check-email', // change this
- data: function() {
- return {
- email: form.querySelector('[name="email"]').value
- };
- },
- delay: 0, // wait 500ms after last input before sending ajax
- }
- }
- },
- 'phone': {
- validators: {
- notEmpty: {
- message: 'Phone is required'
- },
- remote: {
- message: 'Phone is already registered',
- method: 'GET',
- url: backend_url+'/users/check-phone', // change this
- data: function() {
- return {
- email: form.querySelector('[name="phone"]').value
- };
- },
- delay: 0, // wait 500ms after last input before sending ajax
- }
- }
- },
- 'date_of_join': {
- validators: {
- notEmpty: {
- message: 'Date Of Join is required'
- }
- }
- },
- 'employee_type_id': {
- validators: {
- notEmpty: {
- message: 'Employee Type is required'
- }
- }
- },
- 'department_id': {
- validators: {
- notEmpty: {
- message: 'Department is required'
- }
- }
- },
- 'designation_id': {
- validators: {
- notEmpty: {
- message: 'Designation is required'
- }
- }
- },
- 'permanent_state_id': {
- validators: {
- notEmpty: {
- message: 'Permanent State is required'
- }
- }
- },
- 'permanent_city': {
- validators: {
- notEmpty: {
- message: 'Permanent City is required'
- }
- }
- },
- 'permanent_address': {
- validators: {
- notEmpty: {
- message: 'Permanent Address is required'
- }
- }
- },
- 'current_state_id': {
- validators: {
- notEmpty: {
- message: 'Current State is required'
- }
- }
- },
- 'current_city': {
- validators: {
- notEmpty: {
- message: 'Current City is required'
- }
- }
- },
- 'current_address': {
- validators: {
- notEmpty: {
- message: 'Current Address is required'
- }
- }
- },
- /*'previous_company': {
- validators: {
- notEmpty: {
- message: 'Previous Company is required'
- }
- }
- },*/
- /*'total_experience': {
- validators: {
- notEmpty: {
- message: 'Total Experience is required'
- }
- }
- },*/
- /*'uan_number': {
- validators: {
- notEmpty: {
- message: 'UAN Number is required'
- }
- }
- },*/
- 'status': {
- validators: {
- notEmpty: {
- message: 'Select Status is required'
- }
- }
- },
- },
- plugins: {
- trigger: new FormValidation.plugins.Trigger({
- event: {
- email: "blur",
- phone: "blur",
- },
- }),
- bootstrap: new FormValidation.plugins.Bootstrap5({
- rowSelector: '.fv-row',
- eleInvalidClass: '',
- eleValidClass: ''
- })
- }
- }
- );
- </script>
Advertisement
Add Comment
Please, Sign In to add comment