Files
huntingclubroster/js/addNote.js
T
jric11 1e63076123
Security and workflow regressions / regression (push) Has been cancelled
Chat's updates for security, db and workflow
2026-10-20 06:45:30 -04:00

69 lines
1.4 KiB
JavaScript

// ========
// Add Note
// ========
$(document).ready(function () {
var $application = $("#APPLICATION_MNEMONIC").val(),
$sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
// -----------
// Save Button
// -----------
$(".btnSave").on("click", async function (e) {
e.preventDefault();
$("#addNote").submit();
});
// --------------
// Cancel Button.
// --------------
$(".btnCancel").on("click", async function () {
$sessionStorage.action = $sessionStorage.addNote || "";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
formSubmit($sessionStorage);
});
// ---------------
// Validate Inputs
// ---------------
$("#addNote").submit(async function (e) {
e.preventDefault();
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);
});
});
});