Files
decdata/js/addNote.js
T

68 lines
1.3 KiB
JavaScript
Raw Normal View History

2026-06-30 21:34:42 -04:00
// ========
// Add Note
// ========
$(document).ready(function () {
var $application = $("#APPLICATION_MNEMONIC").val(),
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// -----------
// Save Button
// -----------
$(".btnSave").on("click", function (e) {
e.preventDefault();
$("#addNote").submit();
});
// --------------
// Cancel Button.
// --------------
$(".btnCancel").on("click", function () {
$sessionStorage.action = $sessionStorage.addNote || "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// ---------------
// Validate Inputs
// ---------------
$("#addNote").submit(function (e) {
var note_text = $("#note_text");
clearInputErrors();
if (isBlank(note_text)) {
createInputError(note_text, "Note is required");
return false;
}
e.preventDefault();
$.post("./", $(this).serialize())
.done(function () {
$sessionStorage.action = $sessionStorage.addNote || "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
});
});