Index: lams_central/web/authoring/template/comms.jsp =================================================================== diff -u -r08a2133f0cddf6ef58bdd8bd6ea21c6d73cc354f -r1c3d21d9fdee96b507a158f84564fafbef9a6ecb --- lams_central/web/authoring/template/comms.jsp (.../comms.jsp) (revision 08a2133f0cddf6ef58bdd8bd6ea21c6d73cc354f) +++ lams_central/web/authoring/template/comms.jsp (.../comms.jsp) (revision 1c3d21d9fdee96b507a158f84564fafbef9a6ecb) @@ -399,3 +399,23 @@ } return true; } + + // Functions used of x-editable. + // Shown as a fudge the validator to keep x-editable compatible with jquery validator + function onShownForXEditable(e, editable) { + $(this).nextAll('i.fa-pencil').hide(); + var $innerForm = $(this).data('editable').input.$input.closest('form'); + var $outerForm = $innerForm.parents('form').eq(0); + $innerForm.data('validator', $outerForm.data('validator')); + } + function onHiddenForXEditable(e, reason) { + $(this).nextAll('i.fa-pencil').show(); + } + function validateXEditable(value) { + //close editing area on validation failure + if (!value.trim()) { + $('.editable-open').editableContainer('hide', 'cancel'); + return 'Can not be empty!'; + } + } + \ No newline at end of file