You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

118 lines
4.1 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. var mId;
  2. function ContentPlaceHolderName(idVal) {
  3. mId = idVal;
  4. }
  5. function ValidRequiredField(RequiredField) {
  6. var Isvalid = true;
  7. var OtherPersonFld = new Array;
  8. var fld = RequiredField.split(',');
  9. for (n = 0; n < fld.length; n++) {
  10. OtherPersonFld[n] = mId + fld[n];
  11. }
  12. for (i = 0; i < OtherPersonFld.length; i++) {
  13. $('#' + OtherPersonFld[i]).css('background-color', '#FFFFFF');
  14. var a = $('#' + OtherPersonFld[i]).val();
  15. if (a === "" || a === null || a === "0") {
  16. $('#' + OtherPersonFld[i]).css('background-color', '#FFCCD2');
  17. Isvalid = false;
  18. }
  19. }
  20. if (Isvalid === false) {
  21. //ShowAlertMessage('Required Field(s)\n _____________________________ \n The red fields are required!', 'info');
  22. swal('Required Field(s)\n _____________________________ \n The red fields are required!');
  23. //alert('Required Field(s)\n _____________________________ \n The red fields are required!', 'info');
  24. }
  25. return Isvalid;
  26. }
  27. function ValidRequiredFieldWithDoc(RequiredField) {
  28. var Isvalid = true;
  29. var OtherPersonFld = new Array;
  30. var fld = RequiredField.split(',');
  31. for (n = 0; n < fld.length; n++) {
  32. OtherPersonFld[n] = mId + fld[n];
  33. }
  34. for (i = 0; i < OtherPersonFld.length; i++) {
  35. if (OtherPersonFld[i] == 'MainContent_reg_front_id') {
  36. $('#front').css('background-color', '#FFFFFF');
  37. var a = $('#' + OtherPersonFld[i]).val();
  38. if (a === "" || a === null || a === "0") {
  39. $('#front').css('background-color', '#FFCCD2');
  40. Isvalid = false;
  41. }
  42. } else if (OtherPersonFld[i] == 'MainContent_reg_back_id') {
  43. $('#back').css('background-color', '#FFFFFF');
  44. var b = $('#' + OtherPersonFld[i]).val();
  45. if (b === "" || b === null || b === "0") {
  46. $('#back').css('background-color', '#FFCCD2');
  47. Isvalid = false;
  48. }
  49. } else {
  50. $('#' + OtherPersonFld[i]).css('background-color', '#FFFFFF');
  51. var c = $('#' + OtherPersonFld[i]).val();
  52. if (c === "" || c === null || c === "0") {
  53. $('#' + OtherPersonFld[i]).css('background-color', '#FFCCD2');
  54. Isvalid = false;
  55. }
  56. }
  57. }
  58. if (Isvalid === false) {
  59. //ShowAlertMessage('Required Field(s)\n _____________________________ \n The red fields are required!', 'info');
  60. swal('Required Field(s)\n _____________________________ \n The red fields are required!');
  61. //alert('Required Field(s)\n _____________________________ \n The red fields are required!', 'info');
  62. }
  63. return Isvalid;
  64. }
  65. function AlertMsg(result) {
  66. if (result.ResponseCode === "0") {
  67. swal(result.Msg, "", "success");
  68. }
  69. swal(result.Msg, "", "error");
  70. }
  71. function SetValueById(id, value, innerHTML) {
  72. SetValueByObj(GetElement(id), value, innerHTML);
  73. }
  74. function SetValueByObj(obj, value, innerHTML) {
  75. if (innerHTML) {
  76. obj.innerHTML = innerHTML;
  77. } else {
  78. obj.value = value;
  79. }
  80. }
  81. function GetElement(id) {
  82. return document.getElementById(id);
  83. }
  84. function GetValue(id) {
  85. var obj = document.getElementById(id);
  86. if (obj == null || obj == undefined)
  87. return "";
  88. return obj.value;
  89. }
  90. function ValidRequiredFieldNew(RequiredField) {
  91. var Isvalid = true;
  92. var OtherPersonFld = new Array;
  93. var fld = RequiredField.split(',');
  94. for (n = 0; n < fld.length - 1; n++) {
  95. OtherPersonFld[n] = fld[n];
  96. }
  97. for (i = 0; i < OtherPersonFld.length; i++) {
  98. GetElement(OtherPersonFld[i]).style.background = "#FFFFFF";
  99. var a = GetElement(OtherPersonFld[i]).value;
  100. if (GetElement(OtherPersonFld[i]).value == "") {
  101. GetElement(OtherPersonFld[i]).style.background = "#FFCCD2";
  102. Isvalid = false;
  103. }
  104. }
  105. if (Isvalid == false) {
  106. alert("Required Field(s)\n _____________________________ \n The red fields are required!")
  107. }
  108. return Isvalid;
  109. }