fixed validate item attributes

This commit is contained in:
Aung Myo
2018-06-15 11:39:39 +06:30
parent f41b882730
commit 2bd2de7da6
2 changed files with 40 additions and 3 deletions

View File

@@ -1,7 +1,7 @@
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-9 col-lg-9">
<%= simple_form_for([:settings,@category, @settings_menu_item]) do |f| %>
<%= simple_form_for([:settings,@category, @settings_menu_item],:html => {:onsubmit=>"return validateForm()"}) do |f| %>
<%= f.error_notification %>
<div class="card">
<div class="row">
@@ -92,4 +92,22 @@
</div>
</div>
<script>
function validateForm() {
var x = $(".item_attributes").val();
if (x == null) {
swal({
title: "Opps!",
text: "Item attributes must be filled out",
type: 'error',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
location.reload();
});
return false;
}
}
</script>

View File

@@ -1,7 +1,7 @@
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-9 col-lg-9">
<%= simple_form_for([:settings,@category, @settings_menu_item]) do |f| %>
<%= simple_form_for([:settings,@category, @settings_menu_item],:html => {:onsubmit=>"return validateForm()"}) do |f| %>
<%= f.error_notification %>
<div class="card">
<div class="row">
@@ -88,4 +88,23 @@
</div>
</div>
<script>
function validateForm() {
var x = $(".item_attributes").val();
if (x == null) {
swal({
title: "Opps!",
text: "Item attributes must be filled out",
type: 'error',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
location.reload();
});
return false;
}
}
</script>