home *** CD-ROM | disk | FTP | other *** search
/ Your Business Pak / BusinessPak2.iso / Netscape / CD / as.z / asw.jar / acctInfo.js < prev    next >
Text File  |  1998-10-15  |  4KB  |  108 lines

  1. /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18. <!--  to hide script contents from old browsers
  19.  
  20.  
  21.  
  22. function go()
  23. {
  24.     if (parent.parent.globals.document.vars.editMode.value == "yes")
  25.         return true;
  26.     else
  27.         return(checkData());
  28. }
  29.  
  30.  
  31.  
  32. function checkData()
  33. {
  34.     if (document.forms[0].first.value == "")    {
  35.         alert("You must enter a first name.");
  36.         document.forms[0].first.focus();
  37.         document.forms[0].first.select();
  38.         return false;
  39.         }
  40.     if (document.forms[0].last.value == "")    {
  41.         alert("You must enter a last name.");
  42.         document.forms[0].last.focus();
  43.         document.forms[0].last.select();
  44.         return false;
  45.         }
  46. /*
  47.     if (document.forms[0].areaCode.value == "")    {
  48.         alert("You must enter an area code.");
  49.         document.forms[0].areaCode.focus();
  50.         document.forms[0].areaCode.select();
  51.         return false;
  52.         }
  53.     if (document.forms[0].phoneNumber.value == "")    {
  54.         alert("You must enter a telephone number.");
  55.         document.forms[0].phoneNumber.focus();
  56.         document.forms[0].phoneNumber.select();
  57.         return false;
  58.         }
  59. */
  60.     return true;
  61. }
  62.  
  63.  
  64.  
  65. function loadData()
  66. {
  67.     // make sure all data objects/element exists and valid; otherwise, reload.  SUCKS!
  68.     if (((document.forms[0].first == "undefined") || (document.forms[0].first == "[object InputArray]")) ||
  69.         ((document.forms[0].last == "undefined") || (document.forms[0].last == "[object InputArray]")) ||
  70.         ((document.forms[0].company == "undefined") || (document.forms[0].company == "[object InputArray]")))
  71.     {
  72.         parent.controls.reloadDocument();
  73.         return;
  74.     }
  75.  
  76.     document.forms[0].first.value = parent.parent.globals.document.vars.first.value;
  77.     document.forms[0].last.value = parent.parent.globals.document.vars.last.value;
  78.     document.forms[0].company.value = parent.parent.globals.document.vars.company.value;
  79. //    document.forms[0].areaCode.value = parent.parent.globals.document.vars.areaCode.value;
  80. //    document.forms[0].phoneNumber.value = parent.parent.globals.document.vars.phoneNumber.value;
  81.     parent.parent.globals.setFocus(document.forms[0].first);
  82.     if (parent.controls.generateControls)    parent.controls.generateControls();
  83. }
  84.  
  85.  
  86.  
  87. function saveData()
  88. {
  89.     // make sure all form element are valid objects, otherwise just skip & return!
  90.     if (((document.forms[0].first == "undefined") || (document.forms[0].first == "[object InputArray]")) ||
  91.         ((document.forms[0].last == "undefined") || (document.forms[0].last == "[object InputArray]")) ||
  92.         ((document.forms[0].company == "undefined") || (document.forms[0].company == "[object InputArray]")))
  93.     {
  94.         parent.controls.reloadDocument();
  95.         return;
  96.     }
  97.  
  98.     parent.parent.globals.document.vars.first.value = document.forms[0].first.value;
  99.     parent.parent.globals.document.vars.last.value = document.forms[0].last.value;
  100.     parent.parent.globals.document.vars.company.value = document.forms[0].company.value;
  101. //    parent.parent.globals.document.vars.areaCode.value = document.forms[0].areaCode.value;
  102. //    parent.parent.globals.document.vars.phoneNumber.value = document.forms[0].phoneNumber.value;
  103. }
  104.  
  105.  
  106.  
  107. // end hiding contents from old browsers  -->
  108.