1
0

profile.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* $Id: profile.js 2937 2007-04-20 18:42:51Z b4rt $ */
  2. /**
  3. * validateSettings
  4. */
  5. function validateProfileSettings() {
  6. var msg = "";
  7. if (document.theForm.name.value == "") {
  8. msg = msg + "* Name must contain a value.\n";
  9. document.theForm.name.focus();
  10. }
  11. if (isNumber(document.theForm.rate.value) == false) {
  12. msg = msg + "* Max Upload Rate must be a valid number.\n";
  13. document.theForm.rate.focus();
  14. }
  15. if (isNumber(document.theForm.drate.value) == false) {
  16. msg = msg + "* Max Download Rate must be a valid number.\n";
  17. document.theForm.drate.focus();
  18. }
  19. if (isNumber(document.theForm.maxuploads.value) == false) {
  20. msg = msg + "* Max # Uploads must be a valid number.\n";
  21. document.theForm.maxuploads.focus();
  22. }
  23. if (isNumber(document.theForm.maxcons.value) == false) {
  24. msg = msg + "* Max Cons must be a valid number.\n" ;
  25. }
  26. if (isNumber(document.theForm.sharekill.value) == false) {
  27. msg = msg + "* Keep seeding until Sharing % must be a valid number.\n";
  28. document.theForm.sharekill.focus();
  29. }
  30. if (isNumber(document.theForm.rerequest.value) == false) {
  31. msg = msg + "* Rerequest Interval must have a valid number.\n";
  32. document.theForm.rerequest.focus();
  33. }
  34. if (document.theForm.rerequest.value < 10) {
  35. msg = msg + "* Rerequest Interval must be 10 or greater.\n";
  36. document.theForm.rerequest.focus();
  37. }
  38. if ((isNumber(document.theForm.minport.value) == false) || (isNumber(document.theForm.maxport.value) == false)) {
  39. msg = msg + "* Port Range must have valid numbers.\n";
  40. document.theForm.minport.focus();
  41. }
  42. if ((document.theForm.maxport.value > 65535) || (document.theForm.minport.value > 65535)) {
  43. msg = msg + "* Port can not be higher than 65535.\n";
  44. document.theForm.minport.focus();
  45. }
  46. if ((document.theForm.maxport.value < 0) || (document.theForm.minport.value < 0)) {
  47. msg = msg + "* Can not have a negative number for port value.\n";
  48. document.theForm.minport.focus();
  49. }
  50. if (document.theForm.maxport.value < document.theForm.minport.value) {
  51. msg = msg + "* Port Range is not valid.\n";
  52. document.theForm.minport.focus();
  53. }
  54. if (msg != "") {
  55. alert("Please check the following:\n\n" + msg);
  56. return false;
  57. } else {
  58. return true;
  59. }
  60. }