Skip to content

Commit

Permalink
fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
yaza-putu committed Nov 25, 2021
1 parent 1f8ae2e commit 20ff58a
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 26 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
- require jquery
- require sweetalert2
- require toast js
- for validation form only work on bootstrap

# how to install
- clone reposiotry or download and copy the root folder to public folder (LARAVEL Framwork) or any location
Expand Down
1 change: 0 additions & 1 deletion blade/helper/core-helper.blade.php
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
<script src="{{ asset('helpers/validation.js') }}"></script>
<script src="{{ asset('helpers/helpers.js') }}"></script>
26 changes: 26 additions & 0 deletions helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,32 @@ function toastWarning(message, position = 'top-right') {
})
}


// validation handel ajax + laravel : https://gist.github.com/yaza-putu/0e8c13100e1ef9f29306c8c4ef07d3c1

function handleValidation(messages)
{
// reset before looping
$('.invalid-feedback').remove();
for(let i in messages)
{
for(let t in messages[i])
{
$('[name='+i+']').addClass('is-invalid').after('<div class="text-left invalid-feedback">'+messages[i][t]+'</div>');
}

// remove message if event key press
$('[name='+i+']').keypress(function(){
$('[name='+i+']').removeClass('is-invalid');
});

// remove message if event change
$('[name='+i+']').change(function(){
$('[name='+i+']').removeClass('is-invalid');
});
}
}

// reload datatable
function reloadTable(id) {
var table = $(id).DataTable();
Expand Down
25 changes: 0 additions & 25 deletions validation.js

This file was deleted.

0 comments on commit 20ff58a

Please sign in to comment.