tab3.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. function validateOption()
  2. {
  3. document.getElementById("fsync_option_proformaserie_error").style.display = "none";
  4. document.getElementById("fsync_option_daysago_error").style.display = "none";
  5. var days = document.getElementById("fsync_option_daysago").value;
  6. $error = false;
  7. if(days == '' || !days.match(/^\d+$/))
  8. {
  9. document.getElementById("fsync_option_daysago_error").style.display = "block";
  10. $error = true;
  11. }
  12. var radios = document.getElementsByClassName("fsync_option_syncordersas");
  13. for (var i = 0, length = radios.length; i < length; i++) {
  14. if (radios[i].checked) {
  15. if(radios[i].value == 'proforma' && document.getElementById("fsync_option_proformaserie").value == '')
  16. {
  17. document.getElementById("fsync_option_proformaserie_error").style.display = "block";
  18. $error = true;
  19. }
  20. }
  21. }
  22. if($error)
  23. {
  24. return false;
  25. }
  26. else
  27. {
  28. return true;
  29. }
  30. }
  31. function submitOrderOptionForm()
  32. {
  33. if(validateOption()) {
  34. document.getElementById('save-oo-btn').classList.remove('btn-green');
  35. document.getElementById('save-oo-btn').innerHTML = '<img src="View/img/loader.gif" />';
  36. document.getElementById('order_option_form').submit();
  37. }
  38. }
  39. function showOrHideProformaSerie()
  40. {
  41. var radios = document.getElementsByClassName("fsync_option_syncordersas");
  42. for (var i = 0, length = radios.length; i < length; i++) {
  43. if (radios[i].checked) {
  44. if(radios[i].value == 'proforma')
  45. {
  46. document.getElementById("fsync_option_proformaserie").parentElement.parentElement.style.display = 'block';
  47. }
  48. else
  49. {
  50. document.getElementById("fsync_option_proformaserie").parentElement.parentElement.style.display = 'none';
  51. }
  52. break;
  53. }
  54. }
  55. }