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.

144 lines
4.8 KiB

4 years ago
4 years ago
4 years ago
4 years ago
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 ParseDDlDynamic(response, DDL, textField, idField, defaultText) {
  66. var data = response;
  67. var myDDL = GetElement(mId + DDL);
  68. $(myDDL).empty();
  69. var option;
  70. if (defaultText !== "" && defaultText !== undefined) {
  71. option = document.createElement("option");
  72. option.text = defaultText;
  73. option.value = "";
  74. myDDL.options.add(option);
  75. }
  76. for (var i = 0; i < data.length; i++) {
  77. option = document.createElement("option");
  78. option.text = data[i][textField].toUpperCase();
  79. option.value = data[i][idField];
  80. try {
  81. myDDL.options.add(option);
  82. }
  83. catch (e) {
  84. alert(e);
  85. }
  86. }
  87. }
  88. function AlertMsg(result) {
  89. if (result.ResponseCode === "0") {
  90. swal(result.Msg, "", "success");
  91. }
  92. swal(result.Msg, "", "error");
  93. }
  94. function SetValueById(id, value, innerHTML) {
  95. SetValueByObj(GetElement(id), value, innerHTML);
  96. }
  97. function SetValueByObj(obj, value, innerHTML) {
  98. if (innerHTML) {
  99. obj.innerHTML = innerHTML;
  100. } else {
  101. obj.value = value;
  102. }
  103. }
  104. function GetElement(id) {
  105. return document.getElementById(id);
  106. }
  107. function GetValue(id) {
  108. var obj = document.getElementById(id);
  109. if (obj == null || obj == undefined)
  110. return "";
  111. return obj.value;
  112. }
  113. function ValidRequiredFieldNew(RequiredField) {
  114. var Isvalid = true;
  115. var OtherPersonFld = new Array;
  116. var fld = RequiredField.split(',');
  117. for (n = 0; n < fld.length - 1; n++) {
  118. OtherPersonFld[n] = fld[n];
  119. }
  120. for (i = 0; i < OtherPersonFld.length; i++) {
  121. GetElement(OtherPersonFld[i]).style.background = "#FFFFFF";
  122. var a = GetElement(OtherPersonFld[i]).value;
  123. if (GetElement(OtherPersonFld[i]).value == "") {
  124. GetElement(OtherPersonFld[i]).style.background = "#FFCCD2";
  125. Isvalid = false;
  126. }
  127. }
  128. if (Isvalid == false) {
  129. alert("Required Field(s)\n _____________________________ \n The red fields are required!")
  130. }
  131. return Isvalid;
  132. }