first commit
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
|
||||
// ===================
|
||||
// Add Political Party
|
||||
// ===================
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var $application = $("#APPLICATION_MNEMONIC").val(), $sessionStorage = JSON.parse(sessionStorage.getItem($application) || "{}");
|
||||
|
||||
// -----------
|
||||
// Input Masks
|
||||
// -----------
|
||||
|
||||
$("#politicalparty_code").inputmask({
|
||||
regex: "[A-Za-z]{0,3}"
|
||||
});
|
||||
|
||||
// -----------
|
||||
// Save Button
|
||||
// -----------
|
||||
|
||||
$(".btnSave").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
$("#addPoliticalParty").submit();
|
||||
});
|
||||
|
||||
// --------------
|
||||
// Cancel Button.
|
||||
// --------------
|
||||
|
||||
$(".btnCancel").on("click", function () {
|
||||
formSubmit({action: $sessionStorage.addPoliticalParty});
|
||||
});
|
||||
|
||||
// ---------------
|
||||
// Validate Inputs
|
||||
// ---------------
|
||||
|
||||
$("#addPoliticalParty").submit(function (e) {
|
||||
|
||||
var politicalparty_code = $("#politicalparty_code"),
|
||||
politicalparty_name = $("#politicalparty_name");
|
||||
|
||||
clearInputErrors();
|
||||
|
||||
|
||||
if (isBlank(politicalparty_code)) {
|
||||
createInputError(politicalparty_code, "Code is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isBlank(politicalparty_name)) {
|
||||
createInputError(politicalparty_name, "Name is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$.post("./", $(this).serialize())
|
||||
|
||||
.done(function () {
|
||||
|
||||
$sessionStorage.action = $sessionStorage.addPoliticalParty || "";
|
||||
$sessionStorage.toast = "Political Party was Added";
|
||||
|
||||
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
|
||||
|
||||
formSubmit($sessionStorage);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user