Files
Froxlor/templates/Froxlor/assets/js/jquery/validation.js
Michael Kaufmann a11d26522a fix js integrations
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2023-10-18 14:25:02 +02:00

43 lines
919 B
JavaScript

export default function () {
$(function () {
/*
* validation
*/
$('#customer_add,#customer_edit').each(function () {
$(this).validate({
rules: {
'name': {
required: function () {
return $('#company').val().length === 0 || $('#firstname').val().length > 0;
}
},
'firstname': {
required: function () {
return $('#company').val().length === 0 || $('#name').val().length > 0;
}
},
'company': {
required: function () {
return $('#name').val().length === 0
&& $('#firstname').val().length === 0;
}
}
},
});
});
$('#domain_add,#domain_edit').each(function () {
$(this).validate({
rules: {
'ipandport[]': {
required: true,
minlength: 1
}
},
errorPlacement: function (error, element) {
$(error).prependTo($(element).parent().parent());
}
});
});
});
}