Use bootstrap style to highlight fields in error state after failed validation (#116)

This commit is contained in:
jekkos
2016-02-29 08:14:00 +01:00
parent bc8673d883
commit 68c4c1cc56
17 changed files with 49 additions and 30 deletions

View File

@@ -24,7 +24,7 @@
//validation and submit handling
$(document).ready(function()
{
$('#item_form').validate({
$('#item_form').validate($.extend({
submitHandler:function(form)
{
$(form).ajaxSubmit({
@@ -47,6 +47,6 @@ $(document).ready(function()
{
file_path:"<?php echo $this->lang->line('common_import_full_path'); ?>"
}
});
}, dialog_support.error));
});
</script>

View File

@@ -61,7 +61,7 @@ $(document).ready(function()
}, '<?php echo $this->lang->line("customers_account_number_duplicate"); ?>');
$('#customer_form').validate({
$('#customer_form').validate($.extend({
submitHandler:function(form)
{
$(form).ajaxSubmit({
@@ -89,6 +89,6 @@ $(document).ready(function()
last_name: "<?php echo $this->lang->line('common_last_name_required'); ?>",
email: "<?php echo $this->lang->line('common_email_invalid_format'); ?>"
}
});
}, dialog_support.error));
});
</script>

View File

@@ -155,7 +155,7 @@ $(document).ready(function()
});
});
$('#employee_form').validate({
$('#employee_form').validate($.extend({
submitHandler:function(form)
{
$(form).ajaxSubmit({
@@ -226,6 +226,6 @@ $(document).ready(function()
},
email: "<?php echo $this->lang->line('common_email_invalid_format'); ?>"
}
});
}, dialog_support.error));
});
</script>

View File

@@ -79,7 +79,7 @@ $(document).ready(function()
});
};
$('#giftcard_form').validate({
$('#giftcard_form').validate($.extend({
submitHandler:function(form)
{
var selected_person = autocompleter.val();
@@ -115,6 +115,6 @@ $(document).ready(function()
number:"<?php echo $this->lang->line('giftcards_value'); ?>"
}
}
});
}, dialog_support.error));
});
</script>

View File

@@ -96,7 +96,7 @@ $("#item").result(function(event, data, formatted)
//validation and submit handling
$(document).ready(function()
{
$('#item_kit_form').validate({
$('#item_kit_form').validate($.extend({
submitHandler:function(form)
{
$(form).ajaxSubmit({
@@ -121,7 +121,7 @@ $(document).ready(function()
name:"<?php echo $this->lang->line('items_name_required'); ?>",
category:"<?php echo $this->lang->line('items_category_required'); ?>"
}
});
}, dialog_support.error));
});
function deleteItemKitRow(link)

View File

@@ -24,7 +24,7 @@
//validation and submit handling
$(document).ready(function()
{
$('#item_form').validate({
$('#item_form').validate($.extend({
submitHandler:function(form)
{
$(form).ajaxSubmit({
@@ -47,6 +47,6 @@ $(document).ready(function()
{
file_path:"<?php echo $this->lang->line('common_import_full_path'); ?>"
}
});
}, dialog_support.error));
});
</script>

View File

@@ -301,7 +301,7 @@
}, '<?php echo $this->lang->line("items_item_number_duplicate"); ?>');
$('#item_form').validate({
$('#item_form').validate($.extend({
submitHandler:function(form, event)
{
var stay_open = dialog_support.clicked_id() != 'submit';
@@ -388,7 +388,7 @@
number:"<?php echo $this->lang->line('items_reorder_level_number'); ?>"
}
}
});
}, dialog_support.error));
});
</script>

View File

@@ -158,7 +158,7 @@ $(document).ready(function()
});
$("#category").search();
$('#item_form').validate({
$('#item_form').validate($.extend({
submitHandler:function(form)
{
if(confirm("<?php echo $this->lang->line('items_confirm_bulk_edit') ?>"))
@@ -224,6 +224,6 @@ $(document).ready(function()
}
}
});
}, dialog_support.error));
});
</script>

View File

@@ -68,7 +68,7 @@
<link rel="stylesheet" type="text/css" href="dist/opensourcepos.min.css?rel=f940457590"/>
<!-- end mincss template tags -->
<!-- start minjs template tags -->
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=26dfd3d6cc" language="javascript"></script>
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=38ca46b12e" language="javascript"></script>
<!-- end minjs template tags -->
<?php endif; ?>

View File

@@ -1,5 +1,5 @@
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('common_first_name'), 'first_name', array('class'=>'control-label col-xs-3')); ?>
<?php echo form_label($this->lang->line('common_first_name'), 'first_name', array('class'=>'required control-label col-xs-3')); ?>
<div class='col-xs-6'>
<?php echo form_input(array(
'name'=>'first_name',

View File

@@ -147,7 +147,7 @@ $(document).ready(function()
dataType:'json'
});
};
$('#recvs_edit_form').validate(
$('#recvs_edit_form').validate($.extend(
{
submitHandler : function(form)
{
@@ -168,7 +168,7 @@ $(document).ready(function()
{
}
});
}, dialog_support.error));
$('#recvs_delete_form').submit(function()
{
var id = $("input[name='receiving_id']").val();

View File

@@ -161,7 +161,7 @@ $(document).ready(function()
});
};
$('#sales_edit_form').validate(
$('#sales_edit_form').validate($.extend(
{
submitHandler : function(form)
{
@@ -183,7 +183,7 @@ $(document).ready(function()
{
}
});
}, dialog_support.error));
$('#sales_delete_form').submit(function()
{

View File

@@ -48,7 +48,7 @@
//validation and submit handling
$(document).ready(function()
{
$('#supplier_form').validate({
$('#supplier_form').validate($.extend({
submitHandler:function(form)
{
$(form).ajaxSubmit({
@@ -77,7 +77,7 @@ $(document).ready(function()
last_name: "<?php echo $this->lang->line('common_last_name_required'); ?>",
email: "<?php echo $this->lang->line('common_email_invalid_format'); ?>"
}
});
}, dialog_support.error));
});
</script>

13
dist/opensourcepos.js vendored
View File

@@ -52138,7 +52138,6 @@ dialog_support = (function() {
{
btn_id = button_id;
dialog_ref = dlog_ref;
debugger;;
if (button_id == 'delete')
{
$("form[id*='delete_form']").submit();
@@ -52201,7 +52200,17 @@ dialog_support = (function() {
hide: hide,
clicked_id: clicked_id,
init: init,
submit: submit
submit: submit,
error: {
highlight: function (e)
{
$(e).closest('.form-group').addClass('has-error');
},
unhighlight: function (e)
{
$(e).closest('.form-group').removeClass('has-error');
}
}
};
})();

View File

File diff suppressed because one or more lines are too long

View File

@@ -463,7 +463,17 @@ dialog_support = (function() {
hide: hide,
clicked_id: clicked_id,
init: init,
submit: submit
submit: submit,
error: {
highlight: function (e)
{
$(e).closest('.form-group').addClass('has-error');
},
unhighlight: function (e)
{
$(e).closest('.form-group').removeClass('has-error');
}
}
};
})();

View File

@@ -69,7 +69,7 @@
<!-- end mincss template tags -->
<link rel="stylesheet" type="text/css" href="templates/spacelab/css/style.css"/>
<!-- start minjs template tags -->
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=26dfd3d6cc" language="javascript"></script>
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=38ca46b12e" language="javascript"></script>
<!-- end minjs template tags -->
<?php endif; ?>