home *** CD-ROM | disk | FTP | other *** search
/ ftp.tcs3.com / ftp.tcs3.com.tar / ftp.tcs3.com / DRIVERS / Audio / Office2010 / ProPlus.WW / ProPsWW.cab / FORM.JS4 < prev    next >
Text File  |  2007-02-04  |  79KB  |  2,116 lines

  1. /*********************************************************************
  2.                                  Notice
  3.  
  4. You may not modify, use, copy or distribute this file or its contents. 
  5. Internal interfaces referenced in this file are nonpublic, unsupported 
  6. and subject to change without notice. These interfaces may not be 
  7. utilized in other software applications or components.
  8.  
  9.  
  10. *********************************************************************/
  11.  
  12. // This is an enum of all types of objects that can be on a form.
  13. var FormObjectType_Unknown = -1;
  14. var FormObjectType_FieldGroup = 0;
  15. var FormObjectType_TabGroup = 1;
  16. var FormObjectType_Tab = 2;
  17. var FormObjectType_SystemField = 3;
  18. var FormObjectType_Text = 4;
  19. var FormObjectType_MultiLineText = 5;
  20. var FormObjectType_UnformattedNumber = 6;
  21. var FormObjectType_Number = 7;
  22. var FormObjectType_Currency = 8;
  23. var FormObjectType_Date = 9;
  24. var FormObjectType_DateTime = 10;
  25. var FormObjectType_CheckBox = 11;
  26. var FormObjectType_Password = 12;
  27. var FormObjectType_OptionButtons = 13;
  28. var FormObjectType_DropDownList = 14;
  29. var FormObjectType_ListBox = 15;
  30. var FormObjectType_RichText = 16;
  31. var FormObjectType_Attachments = 17;
  32. var FormObjectType_StaticText = 18;
  33. var FormObjectType_FormHeading = 19;
  34. var FormObjectType_SectionHeading = 20;
  35. var FormObjectType_HorizontalLine = 21;
  36. var FormObjectType_NewLine = 22;
  37. var FormObjectType_ScriptButton = 23;
  38. var FormObjectType_Image = 24;
  39. var FormObjectType_Contact = 25;
  40. var FormObjectType_EmbeddedView = 26;
  41.  
  42. // ============================================ \\
  43. // ===        Field Container Class         === \\
  44. // ============================================ \\
  45.  
  46. function FieldContainer(i_IsHeading)
  47. {
  48.     this.IsHeading            = i_IsHeading;
  49.     this.NumberOfColumns    = 1;
  50.     this.Fields                = new Array();
  51.     this.FieldGroups        = new Array();
  52.     this.TabGroups            = new Array();
  53.     this.FormObjects        = new Array();
  54.     this.IsInitialized        = false;
  55. }
  56.  
  57. FieldContainer.prototype.addField = function(i_Field) { this.Fields.push(i_Field); }
  58. FieldContainer.prototype.addSpacer = function() { this.Fields.push(null); }
  59. FieldContainer.prototype.addFieldGroup = function(i_FieldGroup) { this.FieldGroups.push(i_FieldGroup); }
  60. FieldContainer.prototype.addTabGroup = function(i_TabGroup) { this.TabGroups.push(i_TabGroup); }
  61. FieldContainer.prototype.displayFields = function() { document.write(getFields(this)); }
  62.  
  63. function getFields(i_objContainer)
  64. {
  65.     var strFields = "";
  66.  
  67.     if (i_objContainer.Fields.length > 0)
  68.     {
  69.         var objTableNoFieldsInfo = document.getElementById("tableNoFieldsInfo");
  70.         if (objTableNoFieldsInfo != null)
  71.             objTableNoFieldsInfo.style.display = "none";
  72.  
  73.         var objDivHeadingFieldsContainer = document.getElementById("divHeadingFieldsContainer");
  74.         if (objDivHeadingFieldsContainer != null)
  75.             objDivHeadingFieldsContainer.style.display = "inline";
  76.  
  77.         var objDivFieldsContainer = document.getElementById("divFieldsContainer");
  78.         if (objDivFieldsContainer != null)
  79.             objDivFieldsContainer.style.display = "inline";
  80.  
  81.         if (!i_objContainer.IsInitialized)
  82.         {
  83.             // Remove field group shared cells from the total cell count.
  84.             for (var i = 0; i < i_objContainer.FieldGroups.length; i++)
  85.             {
  86.                 for (var j = 0; j < i_objContainer.FieldGroups[i].FieldNames.length; j++)
  87.                 {
  88.                     var FieldName = i_objContainer.FieldGroups[i].FieldNames[j];
  89.                     if (eval("typeof obj" + FieldName) != "undefined")
  90.                     {
  91.                         var Field = eval("obj" + FieldName);
  92.                         i_objContainer.FieldGroups[i].addField(Field);
  93.                         Field.FieldGroup = i_objContainer.FieldGroups[i];
  94.                     }
  95.                 }
  96.             }
  97.  
  98.             // Remove tab group shared cells from the total cell count.
  99.             for (var i = 0; i < i_objContainer.TabGroups.length; i++)
  100.             {
  101.                 for (var j = 0; j < i_objContainer.TabGroups[i].Tabs.length; j++)
  102.                 {
  103.                     for (var k = 0; k < i_objContainer.TabGroups[i].Tabs[j].FieldNames.length; k++)
  104.                     {
  105.                         var FieldName = i_objContainer.TabGroups[i].Tabs[j].FieldNames[k];
  106.                         if (eval("typeof obj" + FieldName) != "undefined")
  107.                         {
  108.                             var Field = eval("obj" + FieldName);
  109.                             i_objContainer.TabGroups[i].Tabs[j].addField(Field);
  110.                             Field.TabGroup = i_objContainer.TabGroups[i];
  111.                             Field.Tab = i_objContainer.TabGroups[i].Tabs[j];
  112.                         }
  113.                     }
  114.                 }
  115.             }
  116.  
  117.             // Set up ordered array of form objects.
  118.             var FormObjectArray = new Array();
  119.             for (var i = 0; i < i_objContainer.Fields.length; i++)
  120.             {
  121.                 var Field = i_objContainer.Fields[i];
  122.                 if (Field.FieldGroup != null)
  123.                 {
  124.                     if (Field.FieldGroup.TabGroup != null)
  125.                     {
  126.                         if (!isFormObjectInArray(Field.FieldGroup.TabGroup.Name, FormObjectArray))
  127.                             FormObjectArray.push(Field.FieldGroup.TabGroup);
  128.                         continue;
  129.                     }
  130.  
  131.                     if (!isFormObjectInArray(Field.FieldGroup.Name, FormObjectArray))
  132.                         FormObjectArray.push(Field.FieldGroup);
  133.                 }
  134.                 else if (Field.TabGroup != null)
  135.                 {
  136.                     if (!isFormObjectInArray(Field.TabGroup.Name, FormObjectArray))
  137.                         FormObjectArray.push(Field.TabGroup);
  138.                 }
  139.                 else
  140.                 {
  141.                     if (!isFormObjectInArray(Field.Name, FormObjectArray))
  142.                         FormObjectArray.push(Field);
  143.                 }
  144.             }
  145.             i_objContainer.FormObjects = FormObjectArray;
  146.  
  147.             i_objContainer.IsInitialized = true;
  148.         }
  149.  
  150.         strFields += getTableHTML(i_objContainer);
  151.     }
  152.     else if (g_IsViewSource)
  153.     {
  154.         var objTableNoFieldsInfo = document.getElementById("tableNoFieldsInfo");
  155.         if (objTableNoFieldsInfo != null)
  156.             objTableNoFieldsInfo.style.display = "none";
  157.     }
  158.  
  159.     if (g_IsViewSource)
  160.         return strFields.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, "><br>");
  161.     else
  162.         return strFields;
  163. }
  164.  
  165. function getTableHTML(i_objContainer)
  166. {
  167.     var TableHTML = "";
  168.  
  169.     var FieldsCountArray = i_objContainer.Fields;
  170.  
  171.     // Get the cell count by adding up all column and row spans.
  172.     var CellCount = 0;
  173.     var ColumnCount = i_objContainer.NumberOfColumns;
  174.     if (ColumnCount == 0 || ColumnCount == -1)
  175.         ColumnCount = 1;
  176.     for (var FieldCount = 0; FieldCount < FieldsCountArray.length; FieldCount++)
  177.     {
  178.         var CurrentField = FieldsCountArray[FieldCount];
  179.         var ColumnSpan = getColumnSpan(CurrentField);
  180.         var RowSpan = getRowSpan(CurrentField);
  181.         if (ColumnCount <= ColumnSpan)
  182.             ColumnSpan = ColumnCount;
  183.         if (ColumnCount == 1)
  184.             RowSpan = 1;
  185.         CellCount += ColumnSpan * RowSpan;
  186.     }
  187.  
  188.     var WidthAttribute = "";
  189.     var IdAttribute = "";
  190.     if (i_objContainer instanceof FieldContainer)
  191.     {
  192.         // Remove field group shared cells from the total cell count.
  193.         for (var i = 0; i < i_objContainer.FieldGroups.length; i++)
  194.         {
  195.             CellCount -= i_objContainer.FieldGroups[i].Fields.length - 1;
  196.         }
  197.  
  198.         // Remove tab group shared cells from the total cell count.
  199.         for (var i = 0; i < i_objContainer.TabGroups.length; i++)
  200.         {
  201.             for (var j = 0; j < i_objContainer.TabGroups[i].Tabs.length; j++)
  202.             {
  203.                 CellCount -= i_objContainer.TabGroups[i].Tabs[j].Fields.length - 1;
  204.             }
  205.         }
  206.  
  207.         if (i_objContainer.IsHeading)
  208.         {
  209.             WidthAttribute = " WIDTH=\"100%\"";
  210.             IdAttribute = " ID=\"HeadingTable\"";
  211.         }
  212.         else
  213.             IdAttribute = " ID=\"FieldsTable\"";
  214.     }
  215.  
  216.     var BorderAttribute = " BORDER=\"0\"";
  217.     if (g_ShowBorder)
  218.         BorderAttribute = " BORDER=\"2\"";
  219.  
  220.     TableHTML += "<TABLE CELLPADDING=\"3\" CELLSPACING=\"0\"" + IdAttribute + BorderAttribute + WidthAttribute + "><TR>";
  221.  
  222.     // Get the row counts from the column and cell counts, and init the array.
  223.     var RowCount = Math.round(CellCount / ColumnCount);
  224.     var RowTotalArray = new Array(RowCount);
  225.     for (var i = 0; i < RowTotalArray.length; i++)
  226.     {
  227.         RowTotalArray[i] = 0;
  228.     }
  229.  
  230.     var FieldsArray = new Array();
  231.     if (i_objContainer instanceof Tab)
  232.         FieldsArray = i_objContainer.Fields;
  233.     else if (i_objContainer instanceof FieldContainer)
  234.         FieldsArray = i_objContainer.FormObjects;
  235.  
  236.     var ColumnTotal = 0;
  237.     var CurrentRow = 0;
  238.     for (var FieldCount = 0; FieldCount < FieldsArray.length; FieldCount++)
  239.     {
  240.         // Check to see if we should go to a new row or not.
  241.         if (ColumnTotal >= ColumnCount || RowTotalArray[CurrentRow] >= ColumnCount)
  242.         {
  243.             TableHTML += "</TR><TR>";
  244.             ColumnTotal = 0;
  245.             CurrentRow++;
  246.         }
  247.  
  248.         // Display the field label and body.
  249.         var CurrentField = FieldsArray[FieldCount];
  250.         // Make sure there are no fields that are wider than the layout.
  251.         if (getColumnSpan(CurrentField) > ColumnCount)
  252.             CurrentField.ColumnSpan = ColumnCount - ColumnTotal;
  253.         // Make sure there are no fields with a row span if there is only one column.
  254.         if (ColumnCount == 1 && getRowSpan(CurrentField) > 1)
  255.             CurrentField.RowSpan = 1;
  256.         // Get the cell HTML for the field.
  257.         TableHTML += getFieldCellHTML(CurrentField, i_objContainer);
  258.  
  259.         // Update the row and column totals.
  260.         var CurrentFieldColumnSpan = 1;
  261.         var CurrentFieldRowSpan = 1;
  262.         if (CurrentField != null)
  263.         {
  264.             CurrentFieldColumnSpan = getColumnSpan(CurrentField);
  265.             CurrentFieldRowSpan = getRowSpan(CurrentField);
  266.         }
  267.         // Update the current column total.
  268.         ColumnTotal += CurrentFieldColumnSpan;
  269.         // Update total of all rows this field is in.
  270.         for (var i = 0; i < CurrentFieldRowSpan; i++)
  271.         {
  272.             RowTotalArray[CurrentRow + i] += CurrentFieldColumnSpan;
  273.         }
  274.  
  275.         // Check to see if we should go to a new row or not.
  276.         if (ColumnTotal >= ColumnCount || RowTotalArray[CurrentRow] >= ColumnCount)
  277.         {
  278.             TableHTML += "</TR><TR>";
  279.             ColumnTotal = 0;
  280.             CurrentRow++;
  281.         }
  282.     }
  283.  
  284.     TableHTML += "</TR></TABLE>";
  285.     return TableHTML;
  286. }
  287.  
  288. function getFieldCellHTML(i_FormObject, i_objContainer)
  289. {
  290.     var FieldCellHTML = "";
  291.  
  292.     if (i_FormObject != null)
  293.     {
  294.         if (i_FormObject.Type == FormObjectType_TabGroup)
  295.         {
  296.             var StyleAttribute = "";
  297.             if (i_FormObject.IsHidden || (g_IsReadOnly && i_FormObject.Type == FormObjectType_Attachments))
  298.                 StyleAttribute = " STYLE=\"display:none;\"";
  299.  
  300.             var FieldBodyHTML = "<TABLE CELLPADDING=\"0\" CELLSPACING=\"0\" BORDER=\"0\" WIDTH=\"100%\"" + StyleAttribute + "><TR>";
  301.  
  302.             if (i_FormObject.Tabs.length > 1)
  303.             {
  304.                 FieldBodyHTML += "<TD>";
  305.                 for (var i = 0; i < i_FormObject.Tabs.length; i++)
  306.                 {
  307.                     var Tab = i_FormObject.Tabs[i];
  308.                     var ClassAttribute = " CLASS=\"";
  309.                     if (i == 0)
  310.                     {
  311.                         i_FormObject.ActiveTabName = Tab.Name;
  312.                         ClassAttribute += "activeTab";
  313.                     }
  314.                     else
  315.                         ClassAttribute += "inactiveTab";
  316.                     FieldBodyHTML += "<SPAN OBJECTTYPE=\"Tab\" TABINDEX=\"1\" STYLE=\"padding:2px 8px 2px 8px;\"" + ClassAttribute + "\" ID=\"" + Tab.Name + "\" ONCLICK=\"tabClick(this, obj" + i_FormObject.Name + ")\" ONKEYPRESS=\"tabClick(this, obj" + i_FormObject.Name + ")\">" + Tab.Text + "</SPAN>";
  317.                 }
  318.                 FieldBodyHTML += "</TD></TR><TR>";
  319.             }
  320.             FieldBodyHTML += "<TD CLASS=\"tabContents\">";
  321.  
  322.             for (var i = 0; i < i_FormObject.Tabs.length; i++)
  323.             {
  324.                 var Tab = i_FormObject.Tabs[i];
  325.                 var StyleAttribute = " STYLE=\"display:none; width:100%;\"";
  326.                 if (i_FormObject.ActiveTabName == Tab.Name || (i == 0 && i_FormObject.ActiveTabName == ""))
  327.                     StyleAttribute = " STYLE=\"width:100%;\"";
  328.                 FieldBodyHTML += "<DIV OBJECTTYPE=\"TabContents\" ID=\"" + Tab.Name + "Contents\"" + StyleAttribute + ">";
  329.                 FieldBodyHTML += getTableHTML(Tab);
  330.                 FieldBodyHTML += "</DIV>";
  331.             }
  332.             FieldBodyHTML += "</TD></TR></TABLE>";
  333.  
  334.             // The CLASS attribute for the TD tag.
  335.             var ClassAttribute = "";
  336.             if (i_FormObject.ClassName != "")
  337.                 ClassAttribute = " CLASS=\"" + i_FormObject.ClassName + "\"";
  338.             // The common attributes for label and field TD tags.
  339.             var LabelAttributes = " VALIGN=\"top\" ID=\"" + i_FormObject.Name + "_label\"" + ClassAttribute;
  340.             var FieldAttributes = " VALIGN=\"top\" ID=\"" + i_FormObject.Name + "_field\"" + ClassAttribute;
  341.             // The COLSPAN attribute for the TD tag.
  342.             var ColumnSpan = getSpanAttribute("COLSPAN", getColumnSpan(i_FormObject) * 2);
  343.             // The ROWSPAN attribute for the TD tag.
  344.             var RowSpan = getSpanAttribute("ROWSPAN", getRowSpan(i_FormObject));
  345.             // The COLSPAN attribute for the TD tag.
  346.             var FieldColumnSpan = getSpanAttribute("COLSPAN", (getColumnSpan(i_FormObject) * 2) - 1);
  347.             // The FONT tag containing the field label.
  348.             var FieldLabel = "<FONT CLASS=\"fieldLabel\">" + getFieldLabel(i_FormObject) + "</FONT>";
  349.  
  350.             switch (i_FormObject.LabelPosition)
  351.             {
  352.                 case "Right":
  353.                     FieldCellHTML += "<TD" + FieldAttributes + RowSpan + ">" + FieldBodyHTML + "</TD>";
  354.                     FieldCellHTML += "<TD" + LabelAttributes + FieldColumnSpan + RowSpan + ">" + FieldLabel + "</TD>";
  355.                     break;
  356.                 case "Top":
  357.                     var LineBreak = "<BR>";
  358.                     if (getFieldLabel(i_FormObject).indexOf("<div") >= 0)
  359.                         LineBreak = "";
  360.                     FieldCellHTML += "<TD" + FieldAttributes + ColumnSpan + RowSpan + ">" + ((getFieldLabel(i_FormObject) != "") ? FieldLabel + LineBreak : "") + FieldBodyHTML + "</TD>";
  361.                     break;
  362.                 default:
  363.                     FieldCellHTML += "<TD" + LabelAttributes + RowSpan + ">" + FieldLabel + "</TD>";
  364.                     FieldCellHTML += "<TD" + FieldAttributes + FieldColumnSpan + RowSpan + ">" + FieldBodyHTML + "</TD>";
  365.                     break;
  366.             }
  367.         }
  368.         else
  369.         {
  370.             var FieldBodyHTML = "";
  371.             if (i_FormObject.Type == FormObjectType_FieldGroup)
  372.                 FieldBodyHTML = getFieldGroupBody(i_FormObject, false);
  373.             else
  374.                 FieldBodyHTML = i_FormObject.getBody() + getImageTag(i_FormObject);
  375.  
  376.             // The STYLE attribute for TD tags.
  377.             var FieldStyleAttribute = "";
  378.             var LabelStyleAttribute = "";
  379.             // Hide fields that should be hidden.
  380.             if (i_FormObject.IsHidden || (g_IsReadOnly && i_FormObject.Type == FormObjectType_Attachments))
  381.             {
  382.                 FieldStyleAttribute += " STYLE=\"display:none;\"";
  383.                 LabelStyleAttribute += " STYLE=\"display:none;\"";
  384.             }
  385.  
  386.             // The CLASS attribute for the TD tags.
  387.             var ClassAttribute = "";
  388.             if (i_FormObject.ClassName != "")
  389.                 ClassAttribute = " CLASS=\"" + i_FormObject.ClassName + "\"";
  390.             // The common attributes for label and field TD tags.
  391.             var LabelAttributes = " VALIGN=\"top\" ID=\"" + i_FormObject.Name + "_label\"" + ClassAttribute;
  392.             var FieldAttributes = " VALIGN=\"top\" ID=\"" + i_FormObject.Name + "_field\"" + ClassAttribute;
  393.             // The COLSPAN attribute for the TD tag.
  394.             var ColumnSpan = getSpanAttribute("COLSPAN", getColumnSpan(i_FormObject) * 2);
  395.             // The ROWSPAN attribute for the TD tag.
  396.             var RowSpan = getSpanAttribute("ROWSPAN", getRowSpan(i_FormObject));
  397.  
  398.             if (i_FormObject instanceof Static)
  399.             {
  400.                 var AlignAttribute = "";
  401.                 if (i_FormObject.Center)
  402.                     AlignAttribute = " ALIGN=\"center\"";
  403.  
  404.                 FieldCellHTML += "<TD" + FieldAttributes + FieldStyleAttribute + AlignAttribute + ColumnSpan + RowSpan + ">" + FieldBodyHTML + "</TD>";
  405.             }
  406.             else
  407.             {
  408.                 // The COLSPAN attribute for the TD tag.
  409.                 var FieldColumnSpan = getSpanAttribute("COLSPAN", (getColumnSpan(i_FormObject) * 2) - 1);
  410.                 // The FONT tag containing the field label.
  411.                 var FieldLabel = "<FONT CLASS=\"fieldLabel\">" + getFieldLabel(i_FormObject) + i_FormObject.getRequired() + "</FONT>";
  412.  
  413.                 switch (i_FormObject.LabelPosition)
  414.                 {
  415.                     case "Right":
  416.                         FieldCellHTML += "<TD" + FieldAttributes + FieldStyleAttribute + RowSpan + ">" + FieldBodyHTML + "</TD>";
  417.                         FieldCellHTML += "<TD" + LabelAttributes + LabelStyleAttribute + FieldColumnSpan + RowSpan + ">" + FieldLabel + "</TD>";
  418.                         break;
  419.                     case "Top":
  420.                         var LineBreak = "<BR>";
  421.                         if (getFieldLabel(i_FormObject).indexOf("<div") >= 0)
  422.                             LineBreak = "";
  423.                         FieldCellHTML += "<TD" + FieldAttributes + FieldStyleAttribute + ColumnSpan + RowSpan + ">" + ((getFieldLabel(i_FormObject) != "" || i_FormObject.getRequired() != "") ? FieldLabel + LineBreak : "") + FieldBodyHTML + "</TD>";
  424.                         break;
  425.                     default:
  426.                         FieldCellHTML += "<TD" + LabelAttributes + LabelStyleAttribute + RowSpan + ">" + FieldLabel + "</TD>";
  427.                         FieldCellHTML += "<TD" + FieldAttributes + FieldStyleAttribute + FieldColumnSpan + RowSpan + ">" + FieldBodyHTML + "</TD>";
  428.                         break;
  429.                 }
  430.             }
  431.         }
  432.     }
  433.     else
  434.     {
  435.         FieldCellHTML += "<TD COLSPAN=\"2\"></TD>";
  436.     }
  437.  
  438.     return FieldCellHTML;
  439. }
  440.  
  441. function getFieldLabel(i_Field)
  442. {
  443.     if (i_Field.LabelHTML != "")
  444.         return i_Field.LabelHTML;
  445.     else
  446.         return i_Field.Label;
  447. }
  448.  
  449. function getFieldGroupBody(i_FieldGroup, i_bIsPreview)
  450. {
  451.     var FieldBodyHTML = "";
  452.     for (var i = 0; i < i_FieldGroup.Fields.length; i++)
  453.     {
  454.         var Field = i_FieldGroup.Fields[i];
  455.  
  456.         // The CLASS attribute for the field.
  457.         var ClassAttribute = "";
  458.         if (Field.ClassName != "")
  459.             ClassAttribute = " CLASS=\"" + Field.ClassName + "\"";
  460.  
  461.         var LabelSpanTag = "<FONT ID=\"" + Field.Name + "_label\"" + ClassAttribute + " STYLE=\"padding-right:2px;";
  462.         var FieldSpanTag = "<SPAN ID=\"" + Field.Name + "_field\"" + ClassAttribute + " STYLE=\"padding-right:6px;";
  463.         if (Field.IsHidden)
  464.         {
  465.             LabelSpanTag += "display:none;";
  466.             FieldSpanTag += "display:none;";
  467.         }
  468.         LabelSpanTag += "\"";
  469.         FieldSpanTag += "\"";
  470.  
  471.         // The ONCLICK and ONMOUSEOVER attributes for the SPAN tags.
  472.         var OnClickAttribute = "";
  473.         var OnMouseOverAttribute = "";
  474.         var TitleAttribute = "";
  475.         if (i_bIsPreview)
  476.         {
  477.             OnClickAttribute = " ONCLICK=\"if (typeof obj" + Field.Name + " != 'undefined') { selectField(obj" + Field.Name + "); }\"";
  478.             OnMouseOverAttribute = " ONMOUSEOVER=\"if (typeof obj" + Field.Name + " != 'undefined') { hoverField(obj" + Field.Name + "); }\"";
  479.             TitleAttribute = " TITLE=\"Click to select this field: " + Field.Name + "\"";
  480.         }
  481.  
  482.         LabelSpanTag += OnClickAttribute + OnMouseOverAttribute + TitleAttribute + ">";
  483.         FieldSpanTag += OnClickAttribute + OnMouseOverAttribute + TitleAttribute + ">";
  484.  
  485.         if (Field instanceof Static)
  486.         {
  487.             FieldBodyHTML += FieldSpanTag + Field.getBody() + "</SPAN>";
  488.         }
  489.         else
  490.         {
  491.             var ImgTag = "";
  492.             if (!i_bIsPreview)
  493.                 ImgTag = getImageTag(Field);
  494.  
  495.             switch (Field.LabelPosition)
  496.             {
  497.                 case "Right":
  498.                     FieldBodyHTML += FieldSpanTag + Field.getBody() + ImgTag + "</SPAN>" + LabelSpanTag + Field.getRequired() + getFieldLabel(Field) + "</FONT>";
  499.                     break;
  500.                 case "Top":
  501.                     if (i >= 1)
  502.                         FieldBodyHTML += "<BR>";
  503.                     FieldBodyHTML += LabelSpanTag + getFieldLabel(Field) + Field.getRequired() + "</FONT><BR>" + FieldSpanTag + Field.getBody() + ImgTag + "</SPAN>";
  504.                     break;
  505.                 default:
  506.                     FieldBodyHTML += LabelSpanTag + getFieldLabel(Field) + Field.getRequired() + "</FONT>" + FieldSpanTag + Field.getBody() + ImgTag + "</SPAN>";
  507.                     break;
  508.             }
  509.         }
  510.     }
  511.     return FieldBodyHTML;
  512. }
  513.  
  514. function getImageTag(i_FormObject)
  515. {
  516.     if (i_FormObject instanceof Static || i_FormObject.Type == FormObjectType_SystemField || i_FormObject.Type == FormObjectType_Attachments)
  517.         return "";
  518.     else
  519.         return "<IMG SRC=\"error.gif\" WIDTH=\"12\" HEIGHT=\"12\" STYLE=\"position:absolute; z-index:1; display:none;\" ID=\"" + i_FormObject.Name + "_ErrorImage\">"
  520. }
  521.  
  522. function getValidationScript(i_Type, i_Parameter)
  523. {
  524.     i_Parameter = i_Parameter.replace(/\'/g, "\\'");
  525.     switch (i_Type)
  526.     {
  527.         // GrooveFormsToolFieldValidationType_IsSubStringPresent
  528.         case 1:
  529.             return " isSubStringPresent('" + i_Parameter + "', this);";
  530.         // GrooveFormsToolFieldValidationType_IsSubStringNotPresent
  531.         case 2:
  532.             return " isSubStringNotPresent('" + i_Parameter + "', this);";
  533.         // GrooveFormsToolFieldValidationType_AreAllSubStringsPresent
  534.         case 3:
  535.             return " areAllSubStringsPresent('" + i_Parameter + "', this);";
  536.         // GrooveFormsToolFieldValidationType_AreAnySubStringsPresent
  537.         case 4:
  538.             return " areAnySubStringsPresent('" + i_Parameter + "', this);";
  539.         // GrooveFormsToolFieldValidationType_AreNoSubStringsPresent
  540.         case 5:
  541.             return " areNoSubStringsPresent('" + i_Parameter + "', this);";
  542.         // GrooveFormsToolFieldValidationType_IsValidEmailAddress
  543.         case 6:
  544.             return " isValidEmailAddress(this);";
  545.         // GrooveFormsToolFieldValidationType_IsValidUSZipCode
  546.         case 7:
  547.             return " isValidUSZipCode(this);";
  548.         // GrooveFormsToolFieldValidationType_IsValidPassword
  549.         case 8:
  550.             return " isValidPassword(this);";
  551.         // GrooveFormsToolFieldValidationType_MinimumLength
  552.         case 9:
  553.             return " isMinimumLength('" + i_Parameter + "', this);";
  554.         // GrooveFormsToolFieldValidationType_MaximumLength
  555.         case 10:
  556.             return " isMaximumLength('" + i_Parameter + "', this);";
  557.         // GrooveFormsToolFieldValidationType_IsAlphabeticCharacters
  558.         case 11:
  559.             return " isAlpha(this);";
  560.         // GrooveFormsToolFieldValidationType_HasAlphabeticCharacters
  561.         case 12:
  562.             return " hasAlpha(this);";
  563.         // GrooveFormsToolFieldValidationType_IsNumericCharacters
  564.         case 13:
  565.             return " isNumeric(this);";
  566.         // GrooveFormsToolFieldValidationType_HasNumericCharacters
  567.         case 14:
  568.             return " hasNumeric(this);";
  569.         default:
  570.             return "";
  571.     }
  572. }
  573.  
  574. function getColumnSpan(i_FormObject)
  575. {
  576.     var ColumnSpan = 1;
  577.     if (i_FormObject != null)
  578.     {
  579.         if (i_FormObject.ColumnSpan > 1)
  580.             ColumnSpan = i_FormObject.ColumnSpan;
  581.     }
  582.     return ColumnSpan;
  583. }
  584.  
  585. function getRowSpan(i_FormObject)
  586. {
  587.     var RowSpan = 1;
  588.     if (i_FormObject != null)
  589.     {
  590.         if (i_FormObject.RowSpan > 1)
  591.             RowSpan = i_FormObject.RowSpan;
  592.     }
  593.     return RowSpan;
  594. }
  595.  
  596. function getSpanAttribute(i_Type, i_Span)
  597. {
  598.     var SpanAttribute = "";
  599.     if (i_Span > 1)
  600.         SpanAttribute = " " + i_Type + "=\"" + i_Span + "\"";
  601.     return SpanAttribute;
  602. }
  603.  
  604. function getFieldWidthUnit(i_FieldWidth, i_FieldSizeType)
  605. {
  606.     var WidthStyle = "";
  607.     if (i_FieldWidth.toString() != "")
  608.     {
  609.         switch (i_FieldSizeType)
  610.         {
  611.             case GrooveFormsToolFieldSizeType_Pixels:
  612.                 WidthStyle = i_FieldWidth + "px";
  613.                 break;
  614.             case GrooveFormsToolFieldSizeType_Percent:
  615.                 WidthStyle = i_FieldWidth + "%";
  616.                 break;
  617.             case GrooveFormsToolFieldSizeType_Characters:
  618.             default:
  619.                 WidthStyle = (i_FieldWidth + 2) + "ex";
  620.                 break;
  621.         }
  622.         WidthStyle = "width:" + WidthStyle + ";";
  623.     }
  624.     return WidthStyle;
  625. }
  626.  
  627. function getFieldHeightUnit(i_FieldHeight, i_FieldSizeType)
  628. {
  629.     var HeightStyle = "";
  630.     if (i_FieldHeight.toString() != "")
  631.     {
  632.         switch (i_FieldSizeType)
  633.         {
  634.             case GrooveFormsToolFieldSizeType_Pixels:
  635.                 HeightStyle = i_FieldHeight + "px";
  636.                 break;
  637.             case GrooveFormsToolFieldSizeType_Percent:
  638.                 HeightStyle = i_FieldHeight + "%";
  639.                 break;
  640.             case GrooveFormsToolFieldSizeType_Characters:
  641.             default:
  642.                 HeightStyle = (i_FieldHeight + 1) + "em";
  643.                 break;
  644.         }
  645.         HeightStyle = "height:" + HeightStyle + ";";
  646.     }
  647.     return HeightStyle;
  648. }
  649.  
  650. function isFormObjectInArray(i_ObjectName, i_Array)
  651. {
  652.     for (var j = 0; j < i_Array.length; j++)
  653.     {
  654.         if (i_Array[j].Name == i_ObjectName)
  655.             return true;
  656.     }
  657.  
  658.     return false;
  659. }
  660.  
  661. // ============================================ \\
  662. // ===          Field Group Class           === \\
  663. // ============================================ \\
  664.  
  665. function FieldGroup(i_Name, i_Fields, i_Container)
  666. {
  667.     if (arguments.length > 0)
  668.         this.initFieldGroup(i_Name, i_Fields, i_Container);
  669.  
  670.     this.Label = "";
  671.     this.LabelHTML = "";
  672.     this.LabelPosition = "";
  673.     this.IsHidden = false;
  674.     this.ColumnSpan = 1;
  675.     this.RowSpan = 1;
  676.     this.ClassName = "";
  677.     this.Fields = new Array();
  678.     this.TabGroup = null;
  679.     this.Type = FormObjectType_FieldGroup;
  680. }
  681.  
  682. FieldGroup.prototype.initFieldGroup = function(i_Name, i_Fields, i_Container)
  683. {
  684.     this.Name = i_Name;
  685.  
  686.     if (i_Fields == "")
  687.         this.FieldNames = new Array();
  688.     else
  689.         this.FieldNames = i_Fields.split("|");
  690.  
  691.     i_Container.addFieldGroup(this);
  692. }
  693. FieldGroup.prototype.addField = function(i_Field) { this.Fields.push(i_Field); }
  694. FieldGroup.prototype.getRequired = function() { return ""; }
  695.  
  696. // ============================================ \\
  697. // ===            Tab Group Class           === \\
  698. // ============================================ \\
  699.  
  700. function TabGroup(i_Name, i_Container)
  701. {
  702.     if (arguments.length > 0)
  703.         this.initTabGroup(i_Name, i_Container);
  704.  
  705.     this.Label = "";
  706.     this.LabelHTML = "";
  707.     this.LabelPosition = "";
  708.     this.IsHidden = false;
  709.     this.ColumnSpan = 1;
  710.     this.RowSpan = 1;
  711.     this.ClassName = "";
  712.     this.Tabs = new Array();
  713.     this.ActiveTabName = "";
  714.     this.Type = FormObjectType_TabGroup;
  715. }
  716.  
  717. TabGroup.prototype.initTabGroup = function(i_Name, i_Container)
  718. {
  719.     this.Name = i_Name;
  720.  
  721.     i_Container.addTabGroup(this);
  722. }
  723. TabGroup.prototype.addTab = function(i_Tab) { this.Tabs.push(i_Tab); }
  724. TabGroup.prototype.getRequired = function() { return ""; }
  725.  
  726. // ============================================ \\
  727. // ===              Tab Class               === \\
  728. // ============================================ \\
  729.  
  730. function Tab(i_Name, i_Fields, i_TabGroup)
  731. {
  732.     if (arguments.length > 0)
  733.         this.initTab(i_Name, i_Fields, i_TabGroup);
  734.  
  735.     this.Text = "";
  736.     this.NumberOfColumns = 1;
  737.     this.Fields = new Array();
  738.     this.Type = FormObjectType_Tab;
  739. }
  740.  
  741. Tab.prototype.initTab = function(i_Name, i_Fields, i_TabGroup)
  742. {
  743.     this.Name = i_Name;
  744.  
  745.     if (i_Fields == "")
  746.         this.FieldNames = new Array();
  747.     else
  748.         this.FieldNames = i_Fields.split("|");
  749.  
  750.     i_TabGroup.addTab(this);
  751. }
  752. Tab.prototype.addField = function(i_Field) { this.Fields.push(i_Field); }
  753.  
  754. // ============================================ \\
  755. // ===             Field Class              === \\
  756. // ============================================ \\
  757.  
  758. function Field()
  759. {
  760.     this.Name = "";
  761.     this.Label = "";
  762.     this.LabelHTML = "";
  763.     this.LabelPosition = "Left";
  764.     this.IsHidden = false;
  765.     this.ColumnSpan = 1;
  766.     this.RowSpan = 1;
  767.     this.IsReadOnly = false;
  768.     this.IsRequired = false;
  769.     this.PropagateUpdates = false;
  770.     this.InheritFrom = "";
  771.     this.ClassName = "";
  772.     this.FieldGroup = null;
  773.     this.TabGroup = null;
  774.     this.Tab = null;
  775. }
  776.  
  777. Field.prototype.initField = function(i_Name, i_Label, i_Container)
  778. {
  779.     this.Name = i_Name;
  780.     this.Label = i_Label;
  781.  
  782.     i_Container.addField(this);
  783. }
  784. Field.prototype.getRequired = function() { return ((this.IsRequired && ((!g_IsReadOnly && !g_IsPreviewPane) || g_IsFormPreview)) ? "<FONT STYLE=\"color:#FF0000; margin:0px 2px 0px 2px;\">*</FONT>" : ""); }
  785.  
  786. // ============================================ \\
  787. // ===             System Field             === \\
  788. // ============================================ \\
  789.  
  790. function SystemField(i_Name, i_Label, i_Container)
  791. {
  792.     if (arguments.length > 0)
  793.         this.initField(i_Name, i_Label, i_Container);
  794.  
  795.     this.Type = FormObjectType_SystemField;
  796. }
  797.  
  798. SystemField.prototype = new Field;
  799. SystemField.prototype.getBody = function() { return "<SPAN CLASS=\"system\" ID=\"" + this.Name + "\"></SPAN>"; }
  800.  
  801. // ============================================ \\
  802. // ===              Text Field              === \\
  803. // ============================================ \\
  804.  
  805. function TextField(i_Name, i_Label, i_Container)
  806. {
  807.     if (arguments.length > 0)
  808.         this.initField(i_Name, i_Label, i_Container);
  809.  
  810.     this.Width = "";
  811.     this.WidthType = GrooveFormsToolFieldSizeType_Characters;
  812.     this.MaximumLength = "";
  813.     this.InitialTextType = 0;
  814.     this.InitialTextFunction = "";
  815.     this.ValidationType = 0;
  816.     this.ValidationParameter = "";
  817.     this.HasLookup = false;
  818.     this.Type = FormObjectType_Text;
  819. }
  820.  
  821. TextField.prototype = new Field;
  822. TextField.prototype.getBody = function()
  823. {
  824.     var TextHTML = "";
  825.     if (g_IsReadOnly && !g_IsFormPreview)
  826.     {
  827.         TextHTML  = "<INPUT TYPE=\"text\" STYLE=\"display:none;\" FIELDTYPE=\"" + this.Type + "\" NAME=\"" + this.Name + "\" ID=\"" + this.Name + "\">";
  828.         TextHTML += "<SPAN CLASS=\"inputPreview\" ID=\"" + this.Name + "_preview\" STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\"></SPAN>";
  829.     }
  830.     else
  831.     {
  832.         TextHTML  = "<INPUT";
  833.         TextHTML += " TYPE=\"text\"";
  834.         TextHTML += " CLASS=\"text\"";
  835.         TextHTML += " FIELDTYPE=\"" + this.Type + "\"";
  836.         TextHTML += " NAME=\"" + this.Name + "\"";
  837.         TextHTML += " ID=\"" + this.Name + "\"";
  838.         TextHTML += " TABINDEX=\"1\"";
  839.         TextHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\"";
  840.         TextHTML += " MAXLENGTH=\"" + this.MaximumLength + "\"";
  841.         TextHTML += " INITIALVALUETYPE=\"" + this.InitialTextType + "\"";
  842.         TextHTML += " INITIALVALUEFUNCTION=\"" + this.InitialTextFunction + "\"";
  843.         TextHTML += (this.IsHidden ? " ISHIDDEN" : "");
  844.         TextHTML += (this.IsRequired ? " ISREQUIRED" : "");
  845.         TextHTML += (this.IsReadOnly ? " ISREADONLY" : "");
  846.         TextHTML += (this.HasLookup ? " LOOKUP" : "");
  847.         TextHTML += (this.PropagateUpdates ? " PROPAGATEUPDATES" : "");
  848.         TextHTML += " INHERIT=\"" + this.InheritFrom + "\"";
  849.         TextHTML += " ONBLUR=\"validateRequired(this);" + getValidationScript(this.ValidationType, this.ValidationParameter) + "\"";
  850.         TextHTML += " ONKEYUP=\"setIsDirty()\">";
  851.     }
  852.     return TextHTML;
  853. }
  854.  
  855. // ============================================ \\
  856. // ===        Multi-line Text Field         === \\
  857. // ============================================ \\
  858.  
  859. function MultiLineTextField(i_Name, i_Label, i_Container)
  860. {
  861.     if (arguments.length > 0)
  862.         this.initField(i_Name, i_Label, i_Container);
  863.  
  864.     this.Width = "";
  865.     this.WidthType = GrooveFormsToolFieldSizeType_Characters;
  866.     this.Height = "";
  867.     this.HeightType = GrooveFormsToolFieldSizeType_Characters;
  868.     this.ValidationType = 0;
  869.     this.ValidationParameter = "";
  870.     this.HasLookup = false;
  871.     this.Type = FormObjectType_MultiLineText;
  872. }
  873.  
  874. MultiLineTextField.prototype = new Field;
  875. MultiLineTextField.prototype.getBody = function()
  876. {
  877.     var MultiLineTextHTML = "";
  878.     if (g_IsReadOnly && !g_IsFormPreview)
  879.     {
  880.         MultiLineTextHTML  = "<TEXTAREA TYPE=\"text\" STYLE=\"display:none;\" FIELDTYPE=\"" + this.Type + "\" NAME=\"" + this.Name + "\" ID=\"" + this.Name + "\"></TEXTAREA>";
  881.         MultiLineTextHTML += "<SPAN CLASS=\"textareaPreview\" ID=\"" + this.Name + "_preview\" STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) + getFieldHeightUnit(this.Height, this.HeightType) + "\"></SPAN>";
  882.     }
  883.     else
  884.     {
  885.         MultiLineTextHTML  = "<TEXTAREA";
  886.         MultiLineTextHTML += " FIELDTYPE=\"" + this.Type + "\"";
  887.         MultiLineTextHTML += " NAME=\"" + this.Name + "\"";
  888.         MultiLineTextHTML += " ID=\"" + this.Name + "\"";
  889.         MultiLineTextHTML += " TABINDEX=\"1\"";
  890.         MultiLineTextHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) + getFieldHeightUnit(this.Height, this.HeightType) + "\"";
  891.         MultiLineTextHTML += (this.IsHidden ? " ISHIDDEN" : "");
  892.         MultiLineTextHTML += (this.IsRequired ? " ISREQUIRED" : "");
  893.         MultiLineTextHTML += (this.IsReadOnly ? " ISREADONLY" : "");
  894.         MultiLineTextHTML += (this.HasLookup ? " LOOKUP" : "");
  895.         MultiLineTextHTML += (this.PropagateUpdates ? " PROPAGATEUPDATES" : "");
  896.         MultiLineTextHTML += " INHERIT=\"" + this.InheritFrom + "\"";
  897.         MultiLineTextHTML += " ONBLUR=\"validateRequired(this);" + getValidationScript(this.ValidationType, this.ValidationParameter) + "\"";
  898.         MultiLineTextHTML += " ONKEYUP=\"setIsDirty()\"></TEXTAREA>";
  899.     }
  900.     return MultiLineTextHTML;
  901. }
  902.  
  903. // ============================================ \\
  904. // ===       Unformatted Number Field       === \\
  905. // ============================================ \\
  906.  
  907. function UnformattedNumberField(i_Name, i_Label, i_Container)
  908. {
  909.     if (arguments.length > 0)
  910.         this.initField(i_Name, i_Label, i_Container);
  911.  
  912.     this.Width = "";
  913.     this.WidthType = GrooveFormsToolFieldSizeType_Characters;
  914.     this.MaximumLength = "";
  915.     this.MinimumValue = "";
  916.     this.MaximumValue = "";
  917.     this.Type = FormObjectType_UnformattedNumber;
  918. }
  919.  
  920. UnformattedNumberField.prototype = new Field;
  921. UnformattedNumberField.prototype.getBody = function()
  922. {
  923.     var UnformattedNumberHTML = "";
  924.     if (g_IsReadOnly && !g_IsFormPreview)
  925.     {
  926.         UnformattedNumberHTML  = "<INPUT TYPE=\"text\" STYLE=\"display:none;\" FIELDTYPE=\"" + this.Type + "\" NAME=\"" + this.Name + "\" ID=\"" + this.Name + "\" NOFORMAT DATATYPE=\"Numeric\">";
  927.         UnformattedNumberHTML += "<SPAN CLASS=\"inputPreview\" ID=\"" + this.Name + "_preview\" STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\"></SPAN>";
  928.     }
  929.     else
  930.     {
  931.         UnformattedNumberHTML  = "<INPUT";
  932.         UnformattedNumberHTML += " TYPE=\"text\"";
  933.         UnformattedNumberHTML += " CLASS=\"text\"";
  934.         UnformattedNumberHTML += " FIELDTYPE=\"" + this.Type + "\"";
  935.         UnformattedNumberHTML += " NAME=\"" + this.Name + "\"";
  936.         UnformattedNumberHTML += " ID=\"" + this.Name + "\"";
  937.         UnformattedNumberHTML += " TABINDEX=\"1\"";
  938.         UnformattedNumberHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\"";
  939.         UnformattedNumberHTML += " MAXLENGTH=\"" + this.MaximumLength + "\"";
  940.         UnformattedNumberHTML += (this.IsHidden ? " ISHIDDEN" : "");
  941.         UnformattedNumberHTML += (this.IsRequired ? " ISREQUIRED" : "");
  942.         UnformattedNumberHTML += (this.IsReadOnly ? " ISREADONLY" : "");
  943.         UnformattedNumberHTML += (this.PropagateUpdates ? " PROPAGATEUPDATES" : "");
  944.         UnformattedNumberHTML += " INHERIT=\"" + this.InheritFrom + "\"";
  945.         UnformattedNumberHTML += " MIN=\"" + this.MinimumValue + "\"";
  946.         UnformattedNumberHTML += " MAX=\"" + this.MaximumValue + "\"";
  947.         UnformattedNumberHTML += " NOFORMAT";
  948.         UnformattedNumberHTML += " ONBLUR=\"validateRequired(this); validateNumeric(this);\"";
  949.         UnformattedNumberHTML += " ONKEYUP=\"setIsDirty()\"";
  950.         UnformattedNumberHTML += " DATATYPE=\"Numeric\">";
  951.     }
  952.     return UnformattedNumberHTML;
  953. }
  954.  
  955. // ============================================ \\
  956. // ===             Number Field             === \\
  957. // ============================================ \\
  958.  
  959. function NumberField(i_Name, i_Label, i_Container)
  960. {
  961.     if (arguments.length > 0)
  962.         this.initField(i_Name, i_Label, i_Container);
  963.  
  964.     this.Precision = 2;
  965.     this.Type = FormObjectType_Number;
  966. }
  967.  
  968. NumberField.prototype = new UnformattedNumberField;
  969. NumberField.prototype.getBody = function()
  970. {
  971.     var NumberHTML = "";
  972.     if (g_IsReadOnly && !g_IsFormPreview)
  973.     {
  974.         NumberHTML  = "<INPUT TYPE=\"text\" STYLE=\"display:none;\" FIELDTYPE=\"" + this.Type + "\" NAME=\"" + this.Name + "\" ID=\"" + this.Name + "\" PRECISION=\"" + this.Precision + "\" DATATYPE=\"Numeric\">";
  975.         NumberHTML += "<SPAN CLASS=\"inputPreview\" ID=\"" + this.Name + "_preview\" STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\"></SPAN>";
  976.     }
  977.     else
  978.     {
  979.         NumberHTML  = "<INPUT";
  980.         NumberHTML += " TYPE=\"text\"";
  981.         NumberHTML += " CLASS=\"text\"";
  982.         NumberHTML += " FIELDTYPE=\"" + this.Type + "\"";
  983.         NumberHTML += " NAME=\"" + this.Name + "\"";
  984.         NumberHTML += " ID=\"" + this.Name + "\"";
  985.         NumberHTML += " TABINDEX=\"1\"";
  986.         NumberHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\"";
  987.         NumberHTML += " MAXLENGTH=\"" + this.MaximumLength + "\"";
  988.         NumberHTML += (this.IsHidden ? " ISHIDDEN" : "");
  989.         NumberHTML += (this.IsRequired ? " ISREQUIRED" : "");
  990.         NumberHTML += (this.IsReadOnly ? " ISREADONLY" : "");
  991.         NumberHTML += (this.PropagateUpdates ? " PROPAGATEUPDATES" : "");
  992.         NumberHTML += " INHERIT=\"" + this.InheritFrom + "\"";
  993.         NumberHTML += " PRECISION=\"" + this.Precision + "\"";
  994.         NumberHTML += " MIN=\"" + this.MinimumValue + "\"";
  995.         NumberHTML += " MAX=\"" + this.MaximumValue + "\"";
  996.         NumberHTML += " ONBLUR=\"validateRequired(this); if (validateNumeric(this)) { formatNumeric(this); }\"";
  997.         NumberHTML += " ONKEYUP=\"setIsDirty()\"";
  998.         NumberHTML += " DATATYPE=\"Numeric\">";
  999.     }
  1000.     return NumberHTML;
  1001. }
  1002.  
  1003. // ============================================ \\
  1004. // ===            Currency Field            === \\
  1005. // ============================================ \\
  1006.  
  1007. function CurrencyField(i_Name, i_Label, i_Container)
  1008. {
  1009.     if (arguments.length > 0)
  1010.         this.initField(i_Name, i_Label, i_Container);
  1011.  
  1012.     this.Symbol = "$";
  1013.     this.Precision = 2;
  1014.     this.Type = FormObjectType_Currency;
  1015. }
  1016.  
  1017. CurrencyField.prototype = new UnformattedNumberField;
  1018. CurrencyField.prototype.getBody = function()
  1019. {
  1020.     var CurrencyHTML = "";
  1021.     if (g_IsReadOnly && !g_IsFormPreview)
  1022.     {
  1023.         CurrencyHTML  = "<INPUT TYPE=\"text\" STYLE=\"display:none;\" FIELDTYPE=\"" + this.Type + "\" NAME=\"" + this.Name + "\" ID=\"" + this.Name + "\" PRECISION=\"" + this.Precision + "\" SYMBOL=\"" + this.Symbol + "\" DATATYPE=\"Numeric\">";
  1024.         CurrencyHTML += "<SPAN CLASS=\"inputPreview\" ID=\"" + this.Name + "_preview\" STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\"></SPAN>";
  1025.     }
  1026.     else
  1027.     {
  1028.         CurrencyHTML  = "<INPUT";
  1029.         CurrencyHTML += " TYPE=\"text\"";
  1030.         CurrencyHTML += " CLASS=\"text\"";
  1031.         CurrencyHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1032.         CurrencyHTML += " NAME=\"" + this.Name + "\"";
  1033.         CurrencyHTML += " ID=\"" + this.Name + "\"";
  1034.         CurrencyHTML += " TABINDEX=\"1\"";
  1035.         CurrencyHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\"";
  1036.         CurrencyHTML += " MAXLENGTH=\"" + this.MaximumLength + "\"";
  1037.         CurrencyHTML += (this.IsHidden ? " ISHIDDEN" : "");
  1038.         CurrencyHTML += (this.IsRequired ? " ISREQUIRED" : "");
  1039.         CurrencyHTML += (this.IsReadOnly ? " ISREADONLY" : "");
  1040.         CurrencyHTML += (this.PropagateUpdates ? " PROPAGATEUPDATES" : "");
  1041.         CurrencyHTML += " INHERIT=\"" + this.InheritFrom + "\"";
  1042.         CurrencyHTML += " PRECISION=\"" + this.Precision + "\"";
  1043.         CurrencyHTML += " MIN=\"" + this.MinimumValue + "\"";
  1044.         CurrencyHTML += " MAX=\"" + this.MaximumValue + "\"";
  1045.         CurrencyHTML += " SYMBOL=\"" + this.Symbol + "\"";
  1046.         CurrencyHTML += " ONBLUR=\"validateRequired(this); if (validateNumeric(this)) { formatCurrency(this); }\"";
  1047.         CurrencyHTML += " ONKEYUP=\"setIsDirty()\"";
  1048.         CurrencyHTML += " DATATYPE=\"Numeric\">";
  1049.     }
  1050.     return CurrencyHTML;
  1051. }
  1052.  
  1053. // ============================================ \\
  1054. // ===              Date Field              === \\
  1055. // ============================================ \\
  1056.  
  1057. function DateField(i_Name, i_Label, i_Container)
  1058. {
  1059.     if (arguments.length > 0)
  1060.         this.initField(i_Name, i_Label, i_Container);
  1061.  
  1062.     this.Width = 30;
  1063.     this.WidthType = GrooveFormsToolFieldSizeType_Characters;
  1064.     this.MaximumLength = "";
  1065.     this.InitialDateType = 0;
  1066.     this.InitialDateFunction = "";
  1067.     this.EarliestDate = "";
  1068.     this.LatestDate = "";
  1069.     this.Format = "";
  1070.     this.Type = FormObjectType_Date;
  1071. }
  1072.  
  1073. DateField.prototype = new Field;
  1074. DateField.prototype.getBody = function()
  1075. {
  1076.     var DateHTML = "";
  1077.     if (g_IsReadOnly && !g_IsFormPreview)
  1078.     {
  1079.         DateHTML  = "<INPUT TYPE=\"text\" STYLE=\"display:none;\" FIELDTYPE=\"" + this.Type + "\" NAME=\"" + this.Name + "\" ID=\"" + this.Name + "\" FORMAT=\"" + this.Format + "\" DATATYPE=\"Date\">";
  1080.         DateHTML += "<SPAN CLASS=\"inputPreview\" ID=\"" + this.Name + "_preview\" STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\"></SPAN>";
  1081.     }
  1082.     else
  1083.     {
  1084.         DateHTML  = "<INPUT";
  1085.         DateHTML += " TYPE=\"text\"";
  1086.         DateHTML += " CLASS=\"text\"";
  1087.         DateHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1088.         DateHTML += " NAME=\"" + this.Name + "\"";
  1089.         DateHTML += " ID=\"" + this.Name + "\"";
  1090.         DateHTML += " TABINDEX=\"1\"";
  1091.         DateHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\"";
  1092.         DateHTML += " MAXLENGTH=\"" + this.MaximumLength + "\"";
  1093.         DateHTML += " INITIALVALUETYPE=\"" + this.InitialDateType + "\"";
  1094.         DateHTML += " INITIALVALUEFUNCTION=\"" + this.InitialDateFunction + "\"";
  1095.         DateHTML += (this.IsHidden ? " ISHIDDEN" : "");
  1096.         DateHTML += (this.IsRequired ? " ISREQUIRED" : "");
  1097.         DateHTML += (this.IsReadOnly ? " ISREADONLY" : "");
  1098.         DateHTML += (this.PropagateUpdates ? " PROPAGATEUPDATES" : "");
  1099.         DateHTML += " INHERIT=\"" + this.InheritFrom + "\"";
  1100.         DateHTML += " MIN=\"" + this.EarliestDate + "\"";
  1101.         DateHTML += " MAX=\"" + this.LatestDate + "\"";
  1102.         DateHTML += " FORMAT=\"" + this.Format + "\"";
  1103.         DateHTML += " ONBLUR=\"validateRequired(this); if (validateDate(this)) { cleanDate(this); formatDate(this); }\"";
  1104.         DateHTML += " ONKEYUP=\"setIsDirty()\"";
  1105.         DateHTML += " DATATYPE=\"Date\">";
  1106.  
  1107.         if (!this.IsReadOnly || g_IsSearch)
  1108.         {
  1109.             DateHTML += "<BUTTON CLASS=\"dateButton\"";
  1110.             DateHTML += " NAME=\"" + this.Name + "Button\"";
  1111.             DateHTML += " ID=\"" + this.Name + "Button\"";
  1112.             DateHTML += " TABINDEX=\"1\"";
  1113.             DateHTML += " ONCLICK=\"doCalendar('" + this.Name + "');\">";
  1114.             DateHTML += "<IMG SRC=\"calendar.gif\" WIDTH=15 HEIGHT=13>";
  1115.             DateHTML += "</BUTTON>";
  1116.         }
  1117.     }
  1118.     return DateHTML;
  1119. }
  1120.  
  1121. // ============================================ \\
  1122. // ===           Date Time Field            === \\
  1123. // ============================================ \\
  1124.  
  1125. function DateTimeField(i_Name, i_Label, i_Container)
  1126. {
  1127.     if (arguments.length > 0)
  1128.         this.initField(i_Name, i_Label, i_Container);
  1129.  
  1130.     this.Width = 30;
  1131.     this.WidthType = GrooveFormsToolFieldSizeType_Characters;
  1132.     this.MaximumLength = "";
  1133.     this.InitialDateType = 0;
  1134.     this.InitialDateFunction = "";
  1135.     this.EarliestDate = "";
  1136.     this.LatestDate = "";
  1137.     this.Format = "";
  1138.     this.Type = FormObjectType_DateTime;
  1139. }
  1140.  
  1141. DateTimeField.prototype = new Field;
  1142. DateTimeField.prototype.getBody = function()
  1143. {
  1144.     var DateTimeHTML = "";
  1145.     if (g_IsReadOnly && !g_IsFormPreview)
  1146.     {
  1147.         DateTimeHTML  = "<INPUT TYPE=\"text\" STYLE=\"display:none;\" FIELDTYPE=\"" + this.Type + "\" NAME=\"" + this.Name + "\" ID=\"" + this.Name + "\" FORMAT=\"" + this.Format + "\" DATATYPE=\"Date\">";
  1148.         DateTimeHTML += "<SPAN CLASS=\"inputPreview\" ID=\"" + this.Name + "_preview\" STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\"></SPAN>";
  1149.     }
  1150.     else
  1151.     {
  1152.         DateTimeHTML  = "<INPUT";
  1153.         DateTimeHTML += " TYPE=\"text\"";
  1154.         DateTimeHTML += " CLASS=\"text\"";
  1155.         DateTimeHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1156.         DateTimeHTML += " NAME=\"" + this.Name + "\"";
  1157.         DateTimeHTML += " ID=\"" + this.Name + "\"";
  1158.         DateTimeHTML += " TABINDEX=\"1\"";
  1159.         DateTimeHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\"";
  1160.         DateTimeHTML += " MAXLENGTH=\"" + this.MaximumLength + "\"";
  1161.         DateTimeHTML += " INITIALVALUETYPE=\"" + this.InitialDateType + "\"";
  1162.         DateTimeHTML += " INITIALVALUEFUNCTION=\"" + this.InitialDateFunction + "\"";
  1163.         DateTimeHTML += (this.IsHidden ? " ISHIDDEN" : "");
  1164.         DateTimeHTML += (this.IsRequired ? " ISREQUIRED" : "");
  1165.         DateTimeHTML += (this.IsReadOnly ? " ISREADONLY" : "");
  1166.         DateTimeHTML += (this.PropagateUpdates ? " PROPAGATEUPDATES" : "");
  1167.         DateTimeHTML += " INHERIT=\"" + this.InheritFrom + "\"";
  1168.         DateTimeHTML += " MIN=\"" + this.EarliestDate + "\"";
  1169.         DateTimeHTML += " MAX=\"" + this.LatestDate + "\"";
  1170.         DateTimeHTML += " FORMAT=\"" + this.Format + "\"";
  1171.         DateTimeHTML += " ONBLUR=\"validateRequired(this); if (validateDate(this)) { cleanDate(this); formatDate(this); }\"";
  1172.         DateTimeHTML += " ONKEYUP=\"setIsDirty()\"";
  1173.         DateTimeHTML += " DATATYPE=\"Date\">";
  1174.  
  1175.         // Need a separate input box for time.
  1176.         DateTimeHTML += "<INPUT";
  1177.         DateTimeHTML += " TYPE=\"text\"";
  1178.         DateTimeHTML += " CLASS=\"text\"";
  1179.         DateTimeHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1180.         DateTimeHTML += " NAME=\"" + this.Name + "_Time\"";
  1181.         DateTimeHTML += " ID=\"" + this.Name + "_Time\"";
  1182.         DateTimeHTML += " TABINDEX=\"1\"";
  1183.         DateTimeHTML += " STYLE=\"" + getFieldWidthUnit((this.Width * 0.35), this.WidthType) +"\"";
  1184.         DateTimeHTML += " ONBLUR=\"validateRequired(this.previousSibling); if (validateDate(this.previousSibling)) { cleanDate(this.previousSibling); formatDate(this.previousSibling); }\"";
  1185.         DateTimeHTML += " ONKEYUP=\"setIsDirty()\"";
  1186.         DateTimeHTML += " DATATYPE=\"Time\">";
  1187.  
  1188.         if (!this.IsReadOnly || g_IsSearch)
  1189.         {
  1190.             DateTimeHTML += "<BUTTON CLASS=\"dateButton\"";
  1191.             DateTimeHTML += " NAME=\"" + this.Name + "Button\"";
  1192.             DateTimeHTML += " ID=\"" + this.Name + "Button\"";
  1193.             DateTimeHTML += " TABINDEX=\"1\"";
  1194.             DateTimeHTML += " ONCLICK=\"doCalendar('" + this.Name + "');\">";
  1195.             DateTimeHTML += "<IMG SRC=\"calendar.gif\" WIDTH=15 HEIGHT=13>";
  1196.             DateTimeHTML += "</BUTTON>";
  1197.         }
  1198.     }
  1199.     return DateTimeHTML;
  1200. }
  1201.  
  1202. // ============================================ \\
  1203. // ===           Check Box Field            === \\
  1204. // ============================================ \\
  1205.  
  1206. function CheckBoxField(i_Name, i_Label, i_Container)
  1207. {
  1208.     if (arguments.length > 0)
  1209.         this.initField(i_Name, i_Label, i_Container);
  1210.  
  1211.     this.StoredValue = "";
  1212.     this.IsCheckedByDefault = false;
  1213.     this.Type = FormObjectType_CheckBox;
  1214. }
  1215.  
  1216. CheckBoxField.prototype = new Field;
  1217. CheckBoxField.prototype.getBody = function()
  1218. {
  1219.     var CheckBoxHTML = "<INPUT";
  1220.     CheckBoxHTML += " TYPE=\"checkbox\"";
  1221.     CheckBoxHTML += " CLASS=\"checkbox\"";
  1222.     CheckBoxHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1223.     CheckBoxHTML += " NAME=\"" + this.Name + "\"";
  1224.     CheckBoxHTML += " ID=\"" + this.Name + "\"";
  1225.     CheckBoxHTML += " TABINDEX=\"1\"";
  1226.     CheckBoxHTML += " VALUE=\"" + this.StoredValue + "\"";
  1227.     CheckBoxHTML += (this.IsCheckedByDefault ? " CHECKED" : "");
  1228.     CheckBoxHTML += (this.IsHidden ? " ISHIDDEN" : "");
  1229.     CheckBoxHTML += (this.IsRequired ? " ISREQUIRED" : "");
  1230.     CheckBoxHTML += (this.IsReadOnly ? " ISREADONLY" : "");
  1231.     CheckBoxHTML += (this.PropagateUpdates ? " PROPAGATEUPDATES" : "");
  1232.     CheckBoxHTML += " INHERIT=\"" + this.InheritFrom + "\"";
  1233.     CheckBoxHTML += " ONBLUR=\"validateRequired(this);\"";
  1234.     CheckBoxHTML += " ONCLICK=\"setIsDirty()\">";
  1235.     return CheckBoxHTML;
  1236. }
  1237.  
  1238. // ============================================ \\
  1239. // ===            Password Field            === \\
  1240. // ============================================ \\
  1241.  
  1242. function PasswordField(i_Name, i_Label, i_Container)
  1243. {
  1244.     if (arguments.length > 0)
  1245.         this.initField(i_Name, i_Label, i_Container);
  1246.  
  1247.     this.Width = "";
  1248.     this.WidthType = GrooveFormsToolFieldSizeType_Characters;
  1249.     this.MaximumLength = "";
  1250.     this.ValidationType = 0;
  1251.     this.ValidationParameter = "";
  1252.     this.Type = FormObjectType_Password;
  1253. }
  1254.  
  1255. PasswordField.prototype = new Field;
  1256. PasswordField.prototype.getBody = function()
  1257. {
  1258.     var PasswordHTML = "";
  1259.     if (g_IsReadOnly && !g_IsFormPreview)
  1260.     {
  1261.         PasswordHTML  = "<INPUT TYPE=\"password\" STYLE=\"display:none;\" FIELDTYPE=\"" + this.Type + "\" NAME=\"" + this.Name + "\" ID=\"" + this.Name + "\">";
  1262.         PasswordHTML += "<SPAN CLASS=\"inputPreview\" ID=\"" + this.Name + "_preview\" STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\"></SPAN>";
  1263.     }
  1264.     else
  1265.     {
  1266.         PasswordHTML  = "<INPUT";
  1267.         PasswordHTML += " TYPE=\"password\"";
  1268.         PasswordHTML += " CLASS=\"text\"";
  1269.         PasswordHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1270.         PasswordHTML += " NAME=\"" + this.Name + "\"";
  1271.         PasswordHTML += " ID=\"" + this.Name + "\"";
  1272.         PasswordHTML += " TABINDEX=\"1\"";
  1273.         PasswordHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\"";
  1274.         PasswordHTML += " MAXLENGTH=\"" + this.MaximumLength + "\"";
  1275.         PasswordHTML += (this.IsHidden ? " ISHIDDEN" : "");
  1276.         PasswordHTML += (this.IsRequired ? " ISREQUIRED" : "");
  1277.         PasswordHTML += (this.IsReadOnly ? " ISREADONLY" : "");
  1278.         PasswordHTML += (this.PropagateUpdates ? " PROPAGATEUPDATES" : "");
  1279.         PasswordHTML += " INHERIT=\"" + this.InheritFrom + "\"";
  1280.         PasswordHTML += " ONBLUR=\"validateRequired(this);" + getValidationScript(this.ValidationType, this.ValidationParameter) + "\"";
  1281.         PasswordHTML += " ONKEYUP=\"setIsDirty()\">";
  1282.     }
  1283.     return PasswordHTML;
  1284. }
  1285.  
  1286. // ============================================ \\
  1287. // ===             Option Field             === \\
  1288. // ============================================ \\
  1289.  
  1290. function OptionField()
  1291. {
  1292.     this.Options = new Array();
  1293.     this.Values = new Array();
  1294.     this.DefaultSelection = "";
  1295. }
  1296.  
  1297. OptionField.prototype = new Field;
  1298.  
  1299. // ============================================ \\
  1300. // ===         Radio Buttons Field          === \\
  1301. // ============================================ \\
  1302.  
  1303. function OptionButtonsField(i_Name, i_Label, i_Container)
  1304. {
  1305.     if (arguments.length > 0)
  1306.         this.initField(i_Name, i_Label, i_Container);
  1307.  
  1308.     this.Type = FormObjectType_OptionButtons;
  1309. }
  1310.  
  1311. OptionButtonsField.prototype = new OptionField;
  1312. OptionButtonsField.prototype.getBody = function()
  1313. {
  1314.     var OptionButtonsHTML = "";
  1315.     for (var i = 0; i < this.Options.length; i++)
  1316.     {
  1317.         OptionButtonsHTML += "<INPUT";
  1318.         OptionButtonsHTML += " TYPE=\"radio\"";
  1319.         OptionButtonsHTML += " CLASS=\"radio\"";
  1320.         OptionButtonsHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1321.         OptionButtonsHTML += " NAME=\"" + this.Name + "\"";
  1322.         OptionButtonsHTML += " ID=\"" + this.Name + "\"";
  1323.         OptionButtonsHTML += " TABINDEX=\"1\"";
  1324.         OptionButtonsHTML += " VALUE=\"" + this.Values[i] + "\"";
  1325.         OptionButtonsHTML += (this.IsHidden ? " ISHIDDEN" : "");
  1326.         OptionButtonsHTML += (this.IsRequired ? " ISREQUIRED" : "");
  1327.         OptionButtonsHTML += (this.IsReadOnly ? " ISREADONLY" : "");
  1328.         OptionButtonsHTML += (this.PropagateUpdates ? " PROPAGATEUPDATES" : "");
  1329.         OptionButtonsHTML += (this.DefaultSelection == this.Options[i] ? " CHECKED" : "");
  1330.         OptionButtonsHTML += " INHERIT=\"" + this.InheritFrom + "\"";
  1331.         OptionButtonsHTML += " ONBLUR=\"validateRequired(this)\"";
  1332.         OptionButtonsHTML += " ONCLICK=\"setIsDirty()\">";
  1333.         OptionButtonsHTML += " ";
  1334.         OptionButtonsHTML += "<FONT>" + this.Options[i] + "</FONT>";
  1335.     }
  1336.     OptionButtonsHTML += "<DIV ID=\"" + this.Name + "_RadioEnd\"></DIV>";
  1337.     return OptionButtonsHTML;
  1338. }
  1339.  
  1340. // ============================================ \\
  1341. // ===           Combo Box Field            === \\
  1342. // ============================================ \\
  1343.  
  1344. function DropDownListField(i_Name, i_Label, i_Container)
  1345. {
  1346.     if (arguments.length > 0)
  1347.         this.initField(i_Name, i_Label, i_Container);
  1348.  
  1349.     this.AllowUserDefinedValues = false;
  1350.     this.IncludeBlankEntry = false;
  1351.     this.IncludeMemberNames = false;
  1352.     this.HasLookup = false;
  1353.     this.Type = FormObjectType_DropDownList;
  1354. }
  1355.  
  1356. DropDownListField.prototype = new OptionField;
  1357. DropDownListField.prototype.getBody = function()
  1358. {
  1359.     var DropDownListHTML = "";
  1360.     if (g_IsReadOnly && !g_IsFormPreview)
  1361.     {
  1362.         DropDownListHTML  = "<SELECT";
  1363.         DropDownListHTML += " STYLE=\"display:none;\"";
  1364.         DropDownListHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1365.         DropDownListHTML += " NAME=\"" + this.Name + "\"";
  1366.         DropDownListHTML += " ID=\"" + this.Name + "\"";
  1367.         DropDownListHTML += (this.IncludeMemberNames ? " MEMBERS" : "");
  1368.         DropDownListHTML += (this.HasLookup ? " LOOKUP" : "");
  1369.         DropDownListHTML += ">";
  1370.  
  1371.         if (this.IncludeBlankEntry)
  1372.             DropDownListHTML += "<OPTION ORIGINAL></OPTION>";
  1373.  
  1374.         for (var i = 0; i < this.Options.length; i++)
  1375.         {
  1376.             if (this.Options[i] != "" || this.Values[i] != "")
  1377.                 DropDownListHTML += "<OPTION VALUE=\"" + this.Values[i] + "\">" + this.Options[i] + "</OPTION>";
  1378.         }
  1379.  
  1380.         DropDownListHTML += "</SELECT>";
  1381.         DropDownListHTML += "<SPAN CLASS=\"selectPreview\" ID=\"" + this.Name + "_preview\"></SPAN>";
  1382.     }
  1383.     else
  1384.     {
  1385.         DropDownListHTML  = "<SELECT";
  1386.         DropDownListHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1387.         DropDownListHTML += " NAME=\"" + this.Name + "\"";
  1388.         DropDownListHTML += " ID=\"" + this.Name + "\"";
  1389.         DropDownListHTML += " TABINDEX=\"1\"";
  1390.         DropDownListHTML += (this.AllowUserDefinedValues ? " CUSTOM" : "");
  1391.         DropDownListHTML += (this.IncludeMemberNames ? " MEMBERS" : "");
  1392.         DropDownListHTML += (this.IsHidden ? " ISHIDDEN" : "");
  1393.         DropDownListHTML += (this.IsRequired ? " ISREQUIRED" : "");
  1394.         DropDownListHTML += (this.IsReadOnly ? " ISREADONLY" : "");
  1395.         DropDownListHTML += (this.IncludeBlankEntry ? " BLANK" : "");
  1396.         DropDownListHTML += (this.HasLookup ? " LOOKUP" : "");
  1397.         DropDownListHTML += (this.PropagateUpdates ? " PROPAGATEUPDATES" : "");
  1398.         DropDownListHTML += " INHERIT=\"" + this.InheritFrom + "\"";
  1399.         DropDownListHTML += " ONBLUR=\"validateRequired(this);\"";
  1400.         DropDownListHTML += " ONCHANGE=\"setIsDirty();\"";
  1401.         DropDownListHTML += ">";
  1402.  
  1403.         if (this.IncludeBlankEntry || g_IsSearch)
  1404.             DropDownListHTML += "<OPTION ORIGINAL></OPTION>";
  1405.  
  1406.         for (var i = 0; i < this.Options.length; i++)
  1407.         {
  1408.             if (this.Options[i] != "" || this.Values[i] != "")
  1409.             {
  1410.                 DropDownListHTML += "<OPTION ORIGINAL";
  1411.                 DropDownListHTML += " VALUE=\"" + this.Values[i] + "\"";
  1412.                 DropDownListHTML += (this.DefaultSelection == this.Options[i] ? " SELECTED" : "");
  1413.                 DropDownListHTML += ">";
  1414.                 DropDownListHTML += this.Options[i];
  1415.                 DropDownListHTML += "</OPTION>";
  1416.             }
  1417.         }
  1418.  
  1419.         DropDownListHTML += "</SELECT>";
  1420.  
  1421.         if (this.AllowUserDefinedValues)
  1422.         {
  1423.             DropDownListHTML += "<BUTTON CLASS=\"customButton\"";
  1424.             DropDownListHTML += " NAME=\"" + this.Name + "Button\"";
  1425.             DropDownListHTML += " ID=\"" + this.Name + "Button\"";
  1426.             DropDownListHTML += " TABINDEX=\"1\"";
  1427.             DropDownListHTML += " ONCLICK=\"addNewOption('" + this.Name + "');\">+</BUTTON>";
  1428.         }
  1429.     }
  1430.     return DropDownListHTML;
  1431. }
  1432.  
  1433. // ============================================ \\
  1434. // ===            List Box Field            === \\
  1435. // ============================================ \\
  1436.  
  1437. function ListBoxField(i_Name, i_Label, i_Container)
  1438. {
  1439.     if (arguments.length > 0)
  1440.         this.initField(i_Name, i_Label, i_Container);
  1441.  
  1442.     this.AllowMultipleSelection = false;
  1443.     this.IncludeBlankEntry = false;
  1444.     this.IncludeMemberNames = false;
  1445.     this.HasLookup = false;
  1446.     this.NumberVisible = 4;
  1447.     this.Type = FormObjectType_ListBox;
  1448. }
  1449.  
  1450. ListBoxField.prototype = new OptionField;
  1451. ListBoxField.prototype.getBody = function()
  1452. {
  1453.     var ListBoxHTML = "";
  1454.     if (g_IsReadOnly && !g_IsFormPreview)
  1455.     {
  1456.         ListBoxHTML  = "<SELECT";
  1457.         ListBoxHTML += " STYLE=\"display:none;\"";
  1458.         ListBoxHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1459.         ListBoxHTML += " NAME=\"" + this.Name + "\"";
  1460.         ListBoxHTML += " ID=\"" + this.Name + "\"";
  1461.         ListBoxHTML += " SIZE=\"" + this.NumberVisible + "\"";
  1462.         ListBoxHTML += (this.AllowMultipleSelection ? " MULTIPLE" : "");
  1463.         ListBoxHTML += (this.IncludeMemberNames ? " MEMBERS" : "");
  1464.         ListBoxHTML += (this.HasLookup ? " LOOKUP" : "");
  1465.         ListBoxHTML += ">";
  1466.  
  1467.         if (this.IncludeBlankEntry)
  1468.             ListBoxHTML += "<OPTION ORIGINAL></OPTION>";
  1469.  
  1470.         for (var i = 0; i < this.Options.length; i++)
  1471.         {
  1472.             if (this.Options[i] != "" || this.Values[i] != "")
  1473.                 ListBoxHTML += "<OPTION VALUE=\"" + this.Values[i] + "\">" + this.Options[i] + "</OPTION>";
  1474.         }
  1475.  
  1476.         ListBoxHTML += "</SELECT>";
  1477.         ListBoxHTML += "<SPAN CLASS=\"selectPreview\" ID=\"" + this.Name + "_preview\"></SPAN>";
  1478.     }
  1479.     else
  1480.     {
  1481.         ListBoxHTML  = "<SELECT";
  1482.         ListBoxHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1483.         ListBoxHTML += " NAME=\"" + this.Name + "\"";
  1484.         ListBoxHTML += " ID=\"" + this.Name + "\"";
  1485.         ListBoxHTML += " TABINDEX=\"1\"";
  1486.         ListBoxHTML += " SIZE=\"" + this.NumberVisible + "\"";
  1487.         ListBoxHTML += (this.AllowMultipleSelection ? " MULTIPLE" : "");
  1488.         ListBoxHTML += (this.IsHidden ? " ISHIDDEN" : "");
  1489.         ListBoxHTML += (this.IsRequired ? " ISREQUIRED" : "");
  1490.         ListBoxHTML += (this.IsReadOnly ? " ISREADONLY" : "");
  1491.         ListBoxHTML += (this.IncludeBlankEntry ? " BLANK" : "");
  1492.         ListBoxHTML += (this.HasLookup ? " LOOKUP" : "");
  1493.         ListBoxHTML += (this.IncludeMemberNames ? " MEMBERS" : "");
  1494.         ListBoxHTML += (this.PropagateUpdates ? " PROPAGATEUPDATES" : "");
  1495.         ListBoxHTML += " INHERIT=\"" + this.InheritFrom + "\"";
  1496.         ListBoxHTML += " ONBLUR=\"validateRequired(this)\"";
  1497.         ListBoxHTML += " ONCHANGE=\"setIsDirty()\">";
  1498.  
  1499.         if (this.IncludeBlankEntry || g_IsSearch)
  1500.             ListBoxHTML += "<OPTION ORIGINAL></OPTION>";
  1501.  
  1502.         for (var i = 0; i < this.Options.length; i++)
  1503.         {
  1504.             if (this.Options[i] != "" || this.Values[i] != "")
  1505.             {
  1506.                 ListBoxHTML += "<OPTION ORIGINAL";
  1507.                 ListBoxHTML += " VALUE=\"" + this.Values[i] + "\"";
  1508.                 ListBoxHTML += (this.DefaultSelection == this.Options[i] ? " SELECTED" : "");
  1509.                 ListBoxHTML += ">";
  1510.                 ListBoxHTML += this.Options[i];
  1511.                 ListBoxHTML += "</OPTION>";
  1512.             }
  1513.         }
  1514.  
  1515.         ListBoxHTML += "</SELECT>";
  1516.     }
  1517.     return ListBoxHTML;
  1518. }
  1519.  
  1520. // ============================================ \\
  1521. // ===           Rich Text Field            === \\
  1522. // ============================================ \\
  1523.  
  1524. function RichTextField(i_Name, i_Label, i_Container)
  1525. {
  1526.     if (arguments.length > 0)
  1527.         this.initField(i_Name, i_Label, i_Container);
  1528.  
  1529.     this.Width = 45;
  1530.     this.WidthType = GrooveFormsToolFieldSizeType_Characters;
  1531.     this.Height = 10;
  1532.     this.HeightType = GrooveFormsToolFieldSizeType_Characters;
  1533.     this.InitialRTF = "";
  1534.     this.IsBorderHidden = false;
  1535.     this.IsSearchable = false;
  1536.     this.IsCommandBarHidden = true;
  1537.     this.BackgroundColor = "";
  1538.     this.Type = FormObjectType_RichText;
  1539. }
  1540.  
  1541. RichTextField.prototype = new Field;
  1542. RichTextField.prototype.getBody = function()
  1543. {
  1544.     var RichTextHTML = "";
  1545.     if ((g_IsFormPreview && !this.IsCommandBarHidden) || (!g_IsReadOnly && !g_IsPreviewPane && !this.IsCommandBarHidden))
  1546.     {
  1547.         var objRichTextCommandBar = new CommandBar(this.Name, getFieldWidthUnit(this.Width, this.WidthType));
  1548.         var objBoldCommand = new Command(this.Name + "Bold", "rtf_bold.gif", "Bold", "doBold('" + this.Name + "')");
  1549.         objRichTextCommandBar.addCommand(objBoldCommand);
  1550.         var objItalicCommand = new Command(this.Name + "Italic", "rtf_italic.gif", "Italicize", "doItalic('" + this.Name + "')");
  1551.         objRichTextCommandBar.addCommand(objItalicCommand);
  1552.         var objUnderlineCommand = new Command(this.Name + "Underline", "rtf_underline.gif", "Underline", "doUnderline('" + this.Name + "')");
  1553.         objRichTextCommandBar.addCommand(objUnderlineCommand);
  1554.  
  1555.         objRichTextCommandBar.addSeparator();
  1556.  
  1557.         var objChooseFontCommand = new Command(this.Name + "ChooseFont", "rtf_choosefont.gif", "Choose Font", "doChooseFont('" + this.Name + "')");
  1558.         objRichTextCommandBar.addCommand(objChooseFontCommand);
  1559.         var objChooseColorCommand = new Command(this.Name + "ChooseColor", "rtf_choosecolor.gif", "Choose Color", "doChooseColor('" + this.Name + "')");
  1560.         objRichTextCommandBar.addCommand(objChooseColorCommand);
  1561.  
  1562.         objRichTextCommandBar.addSeparator();
  1563.  
  1564.         var objAlignLeftCommand = new Command(this.Name + "AlignLeft", "rtf_alignleft.gif", "Align Left", "doAlignLeft('" + this.Name + "')");
  1565.         objRichTextCommandBar.addCommand(objAlignLeftCommand);
  1566.         var objCenterCommand = new Command(this.Name + "Center", "rtf_center.gif", "Center", "doCenter('" + this.Name + "')");
  1567.         objRichTextCommandBar.addCommand(objCenterCommand);
  1568.         var objAlignRightCommand = new Command(this.Name + "AlignRight", "rtf_alignright.gif", "Align Right", "doAlignRight('" + this.Name + "')");
  1569.         objRichTextCommandBar.addCommand(objAlignRightCommand);
  1570.         var objJustifyCommand = new Command(this.Name + "Justify", "rtf_justify.gif", "Justify", "doJustify('" + this.Name + "')");
  1571.         objRichTextCommandBar.addCommand(objJustifyCommand);
  1572.  
  1573.         objRichTextCommandBar.addSeparator();
  1574.  
  1575.         var objBulletsCommand = new Command(this.Name + "Bullets", "rtf_bullets.gif", "Bullets", "doBullets('" + this.Name + "')");
  1576.         objRichTextCommandBar.addCommand(objBulletsCommand);
  1577.         var objIncreaseIndentCommand = new Command(this.Name + "IncreaseIndent", "rtf_increaseindent.gif", "Increase Indent", "doIncreaseIndent('" + this.Name + "')");
  1578.         objRichTextCommandBar.addCommand(objIncreaseIndentCommand);
  1579.         var objDecreaseIndentCommand = new Command(this.Name + "DecreaseIndent", "rtf_decreaseindent.gif", "Decrease Indent", "doDecreaseIndent('" + this.Name + "')");
  1580.         objRichTextCommandBar.addCommand(objDecreaseIndentCommand);
  1581.  
  1582.         objRichTextCommandBar.addSeparator();
  1583.  
  1584.         var objSpellCheckCommand = new Command(this.Name + "SpellCheck", "rtf_spellcheck.gif", "Check Spelling", "doSpellCheck('" + this.Name + "')");
  1585.         objRichTextCommandBar.addCommand(objSpellCheckCommand);
  1586.         RichTextHTML = objRichTextCommandBar.getBody();
  1587.  
  1588.         var objHyperlinkCommand = new Command(this.Name + "Hyperlink", "rtf_hyperlink.gif", "Hyperlink", "doHyperlink('" + this.Name + "')");
  1589.         objRichTextCommandBar.addCommand(objHyperlinkCommand);
  1590.         RichTextHTML = objRichTextCommandBar.getBody();
  1591.     }
  1592.  
  1593.     if (g_IsFormPreview || !g_IsReadOnly || (g_IsReadOnly && !g_IsPreviewPane))
  1594.     {
  1595.         RichTextHTML += "<SCRIPT LANGUAGE=\"JavaScript\" FOR=\"" + this.Name + "\" EVENT=\"OnChange()\">setIsDirty(); eventHandlerById('OnChange', '" + this.Name + "');</SCRIPT>";
  1596.         if (!g_IsReadOnly && !g_IsFormPreview && !this.IsCommandBarHidden)
  1597.         {
  1598.             RichTextHTML += "<SCRIPT LANGUAGE=\"JavaScript\" FOR=\"" + this.Name + "\" EVENT=\"OnSetFocus()\">startInterval('" + this.Name + "');</SCRIPT>";
  1599.             RichTextHTML += "<SCRIPT LANGUAGE=\"JavaScript\" FOR=\"" + this.Name + "\" EVENT=\"OnKillFocus()\">validateRequiredRichText('" + this.Name + "'); stopInterval('" + this.Name + "'); eventHandlerById('OnBlur', '" + this.Name + "');</SCRIPT>";
  1600.         }
  1601.         else
  1602.         {
  1603.             RichTextHTML += "<SCRIPT LANGUAGE=\"JavaScript\" FOR=\"" + this.Name + "\" EVENT=\"OnKillFocus()\">validateRequiredRichText('" + this.Name + "'); eventHandlerById('OnBlur', '" + this.Name + "');</SCRIPT>";
  1604.         }
  1605.         RichTextHTML += "<OBJECT";
  1606.         RichTextHTML += " CLASSID=\"clsid:E01D1C6A-4F40-11D3-8958-00105A272DCF\"";
  1607.         RichTextHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1608.         RichTextHTML += " NAME=\"" + this.Name + "\"";
  1609.         RichTextHTML += " ID=\"" + this.Name + "\"";
  1610.         RichTextHTML += " TABINDEX=\"1\"";
  1611.         RichTextHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) + getFieldHeightUnit(this.Height, this.HeightType) + "\"";
  1612.         RichTextHTML += " BORDER=0";
  1613.         RichTextHTML += (this.IsHidden ? " ISHIDDEN" : "");
  1614.         RichTextHTML += (this.IsRequired ? " ISREQUIRED" : "");
  1615.         RichTextHTML += (this.IsReadOnly ? " ISREADONLY" : "");
  1616.  
  1617.         if (g_IsReadOnly)
  1618.         {
  1619.             this.IsBorderHidden = true;
  1620.             if (this.BackgroundColor == null || this.BackgroundColor == "")
  1621.                 this.BackgroundColor = "Transparent";
  1622.         }
  1623.  
  1624.         RichTextHTML += (this.IsBorderHidden ? " ISBORDERHIDDEN" : "");
  1625.         RichTextHTML += (this.IsSearchable ? " ISSEARCHABLE" : "");
  1626.         RichTextHTML += (this.PropagateUpdates ? " PROPAGATEUPDATES" : "");
  1627.         RichTextHTML += " BACKGROUNDCOLOR=\"" + this.BackgroundColor + "\"";
  1628.         RichTextHTML += " INHERIT=\"" + this.InheritFrom + "\"";
  1629.         RichTextHTML += " DEFAULT=\"" + this.InitialRTF + "\"";
  1630.         RichTextHTML += " DATATYPE=\"RichText\"></OBJECT>";
  1631.     }
  1632.     else
  1633.     {
  1634.         RichTextHTML += "<OBJECT";
  1635.         RichTextHTML += " CLASSID=\"clsid:E01D1C6A-4F40-11D3-8958-00105A272DCF\"";
  1636.         RichTextHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1637.         RichTextHTML += " NAME=\"" + this.Name + "\"";
  1638.         RichTextHTML += " ID=\"" + this.Name + "\"";
  1639.         RichTextHTML += " STYLE=\"display:none; " + getFieldWidthUnit(this.Width, this.WidthType) + getFieldHeightUnit(this.Height, this.HeightType) + "\"";
  1640.         RichTextHTML += " DATATYPE=\"RichText\"></OBJECT>";
  1641.         RichTextHTML += "<SPAN STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) + " background-color:" + this.BackgroundColor + ";\" ID=\"" + this.Name + "_preview\"></SPAN>";
  1642.     }
  1643.     return RichTextHTML;
  1644. }
  1645.  
  1646. // ============================================ \\
  1647. // ===          Attachments Field           === \\
  1648. // ============================================ \\
  1649.  
  1650. function AttachmentsField(i_Name, i_Label, i_Container)
  1651. {
  1652.     if (arguments.length > 0)
  1653.         this.initField(i_Name, i_Label, i_Container);
  1654.  
  1655.     this.Type = FormObjectType_Attachments;
  1656. }
  1657.  
  1658. AttachmentsField.prototype = new Field;
  1659. AttachmentsField.prototype.getBody = function()
  1660. {
  1661.     var objAttachmentsCommandBar = new CommandBar(this.Name, "width:200px");
  1662.     var objAddCommand = new Command(this.Name + "Add", "add.gif", "Add Attachment(s)", "doAddAttachments()");
  1663.     objAttachmentsCommandBar.addCommand(objAddCommand);
  1664.     var objLaunchCommand = new Command(this.Name + "Launch", "launch.gif", "Launch Selected Attachment(s)", "doLaunchSelectedAttachments()");
  1665.     objAttachmentsCommandBar.addCommand(objLaunchCommand);
  1666.     var objSaveCommand = new Command(this.Name + "Save", "save.gif", "Save Selected Attachment(s)", "doSaveSelectedAttachments()");
  1667.     objAttachmentsCommandBar.addCommand(objSaveCommand);
  1668.     var objDeleteCommand = new Command(this.Name + "Delete", "delete.gif", "Delete Selected Attachment(s)", "doDeleteSelectedAttachments()");
  1669.     objAttachmentsCommandBar.addCommand(objDeleteCommand);
  1670.  
  1671.     var AttachmentsHTML = objAttachmentsCommandBar.getBody();
  1672.  
  1673.     AttachmentsHTML += "<OBJECT";
  1674.     AttachmentsHTML += " CLASSID=\"clsid:0D012ABD-CEED-11D2-9C76-00105AA73033\"";
  1675.     AttachmentsHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1676.     AttachmentsHTML += " NAME=\"" + this.Name + "\"";
  1677.     AttachmentsHTML += " ID=\"" + this.Name + "\"";
  1678.     AttachmentsHTML += " TABINDEX=\"1\"";
  1679.     AttachmentsHTML += " WIDTH=\"200\"";
  1680.     AttachmentsHTML += " HEIGHT=\"75\"";
  1681.     AttachmentsHTML += (this.IsHidden ? " ISHIDDEN" : "");
  1682.     AttachmentsHTML += (this.IsReadOnly ? " ISREADONLY" : "");
  1683.     AttachmentsHTML += (this.PropagateUpdates ? " PROPAGATEUPDATES" : "");
  1684.     AttachmentsHTML += " INHERIT=\"" + this.InheritFrom + "\"";
  1685.     AttachmentsHTML += " TABINDEX=\"-1\"";
  1686.     AttachmentsHTML += " DATATYPE=\"Attachments\"></OBJECT>";
  1687.     return AttachmentsHTML;
  1688. }
  1689. AttachmentsField.prototype.getRequired = function() { return ""; }
  1690.  
  1691. // ============================================ \\
  1692. // ===             Contact Field            === \\
  1693. // ============================================ \\
  1694.  
  1695. function ContactField(i_Name, i_Label, i_Container)
  1696. {
  1697.     if (arguments.length > 0)
  1698.         this.initField(i_Name, i_Label, i_Container);
  1699.  
  1700.     this.IsAwarenessIconHidden = false;
  1701.     this.IsContextMenuHidden = false;
  1702.     this.UseAuthenticationColor = false;
  1703.     this.Type = FormObjectType_Contact;
  1704. }
  1705.  
  1706. ContactField.prototype = new Field;
  1707. ContactField.prototype.getBody = function()
  1708. {
  1709.     var ContactHTML = "<SPAN";
  1710.     ContactHTML += " NAME=\"" + this.Name + "\"";
  1711.     ContactHTML += " ID=\"" + this.Name + "\"";
  1712.     ContactHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1713.     ContactHTML += (this.IsReadOnly ? " ISREADONLY" : "");
  1714.     ContactHTML += (this.IsHidden ? " ISHIDDEN" : "");
  1715.     ContactHTML += (this.IsRequired ? " ISREQUIRED" : "");
  1716.     ContactHTML += (this.PropagateUpdates ? " PROPAGATEUPDATES" : "");
  1717.     ContactHTML += " INHERIT=\"" + this.InheritFrom + "\"";
  1718.     ContactHTML += (this.IsAwarenessIconHidden ? " ISAWARENESSICONHIDDEN" : "");
  1719.     ContactHTML += (this.IsContextMenuHidden ? " ISCONTEXTMENUHIDDEN" : "");
  1720.     ContactHTML += (this.UseAuthenticationColor ? " USEAUTHENTICATIONCOLOR" : "");
  1721.     ContactHTML += " STYLE=\"cursor:default; padding-right:4px;\"";
  1722.     ContactHTML += " DATATYPE=\"Contact\"";
  1723.     ContactHTML += (this.IsContextMenuHidden ? "" : " ONCONTEXTMENU=\"showContactMenu('" + this.Name + "');\"");
  1724.     ContactHTML += " ONDBLCLICK=\"sendMessage('" + this.Name + "');\"";
  1725.     ContactHTML += " ONSELECTSTART=\"return false;\"";
  1726.     ContactHTML += " ONMOUSEOVER=\"updateIdleTime('" + this.Name +"');\">";
  1727.     ContactHTML += "<IMG ID=\"" + this.Name + "_Icon\" STYLE=\"display:none; width:16px; height:16px;\" HSPACE=2>";
  1728.     ContactHTML += "<SPAN ID=\"" + this.Name + "_Name\"></SPAN>";
  1729.     ContactHTML += "</SPAN>";
  1730.  
  1731.     if (!this.IsReadOnly && !g_IsReadOnly && !g_IsSearch)
  1732.     {
  1733.         ContactHTML += "<BUTTON CLASS=\"dateButton\" STYLE=\"height:24px; width:24px;\"";
  1734.         ContactHTML += " NAME=\"" + this.Name + "Button\"";
  1735.         ContactHTML += " ID=\"" + this.Name + "Button\"";
  1736.         ContactHTML += " TABINDEX=\"1\"";
  1737.         ContactHTML += " TITLE=\"Click to select a contact\"";
  1738.         ContactHTML += " ONCLICK=\"selectContact('" + this.Name + "');\">";
  1739.         ContactHTML += "<IMG SRC=\"../../../ToolIcons/ContactSelector.ico\" WIDTH=16 HEIGHT=16>";
  1740.         ContactHTML += "</BUTTON>";
  1741.     }
  1742.  
  1743.     return ContactHTML;
  1744. }
  1745.  
  1746. // ============================================ \\
  1747. // ===         Embedded View Field          === \\
  1748. // ============================================ \\
  1749.  
  1750. function EmbeddedViewField(i_Name, i_Label, i_Container)
  1751. {
  1752.     if (arguments.length > 0)
  1753.         this.initField(i_Name, i_Label, i_Container);
  1754.  
  1755.     this.Width = 40;
  1756.     this.WidthType = GrooveFormsToolFieldSizeType_Characters;
  1757.     this.Height = 10;
  1758.     this.HeightType = GrooveFormsToolFieldSizeType_Characters;
  1759.     this.EmbeddedViewID = -1;
  1760.     this.EmbeddedViewFilter = "";
  1761.     this.Type = FormObjectType_EmbeddedView;
  1762. }
  1763.  
  1764. EmbeddedViewField.prototype = new Field;
  1765. EmbeddedViewField.prototype.getBody = function()
  1766. {
  1767.     var EmbeddedViewHTML = "<DIV";
  1768.     EmbeddedViewHTML += " STYLE=\"border:2px solid black; padding:4px; background-color:white; color:black;\">";
  1769.     EmbeddedViewHTML += "An Embedded View field from a future version of Forms has been added to this form. Please upgrade to the latest version of Groove to enable the field '" + this.Name + "'.";
  1770.     EmbeddedViewHTML += "</DIV>";
  1771.     return EmbeddedViewHTML;
  1772.  
  1773.     /*
  1774.     var EmbeddedViewHTML = "";
  1775.     if (g_IsFormPreview)
  1776.     {
  1777.         EmbeddedViewHTML += "<DIV";
  1778.         EmbeddedViewHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) + getFieldHeightUnit(this.Height, this.HeightType) + " border:1px solid black; background-color:white;\"";
  1779.         EmbeddedViewHTML += ">";
  1780.         EmbeddedViewHTML += "<TABLE WIDTH=\"100%\" HEIGHT=\"100%\"><TR><TD ALIGN=\"center\" VALIGN=\"middle\"><FONT><B>Embedded View field with the name '" + this.Name + "' will display here.</B></FONT></TD></TR></TABLE>";
  1781.         EmbeddedViewHTML += "</DIV>";
  1782.     }
  1783.     else
  1784.     {
  1785.         EmbeddedViewHTML += "<OBJECT";
  1786.         EmbeddedViewHTML += " CLASSID=\"clsid:56A58823-AE99-11D5-B90B-0050DACD1F75\"";
  1787.         EmbeddedViewHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1788.         EmbeddedViewHTML += " NAME=\"" + this.EmbeddedViewID + "\"";
  1789.         EmbeddedViewHTML += " ID=\"" + this.EmbeddedViewID + "\"";
  1790.         EmbeddedViewHTML += " BORDER=\"1\"";
  1791.         EmbeddedViewHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) + getFieldHeightUnit(this.Height, this.HeightType) + "\"";
  1792.         EmbeddedViewHTML += (this.IsHidden ? " ISHIDDEN" : "");
  1793.         EmbeddedViewHTML += " EMBEDDEDVIEWFILTER=\"" + this.EmbeddedViewFilter + "\"";
  1794.         EmbeddedViewHTML += " DATATYPE=\"View\"></OBJECT>";
  1795.     }
  1796.     return EmbeddedViewHTML;
  1797.     */
  1798. }
  1799.  
  1800. // ============================================ \\
  1801. // ===          Static Field Class          === \\
  1802. // ============================================ \\
  1803.  
  1804. function Static()
  1805. {
  1806.     this.Name        = "";
  1807.     this.IsHidden    = false;
  1808.     this.ColumnSpan    = 1;
  1809.     this.RowSpan    = 1;
  1810. }
  1811.  
  1812. Static.prototype.initStatic = function(i_Name, i_Container)
  1813. {
  1814.     this.Name = i_Name;
  1815.  
  1816.     i_Container.addField(this);
  1817. }
  1818.  
  1819. // ============================================ \\
  1820. // ===             Text Static              === \\
  1821. // ============================================ \\
  1822.  
  1823. function StaticTextField(i_Name, i_Container)
  1824. {
  1825.     if (arguments.length > 0)
  1826.         this.initStatic(i_Name, i_Container);
  1827.  
  1828.     this.Text = "";
  1829.     this.Center = false;
  1830.     this.HasLookup = false;
  1831.     this.Type = FormObjectType_StaticText;
  1832. }
  1833.  
  1834. StaticTextField.prototype = new Static;
  1835. StaticTextField.prototype.getBody = function()
  1836. {
  1837.     var StaticTextHTML = "<DIV";
  1838.     StaticTextHTML += " CLASS=\"staticText\"";
  1839.     StaticTextHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1840.     StaticTextHTML += " NAME=\"" + this.Name + "\"";
  1841.     StaticTextHTML += " ID=\"" + this.Name + "\"";
  1842.     StaticTextHTML += (this.IsHidden ? " ISHIDDEN" : "");
  1843.     StaticTextHTML += (this.Center ? " ALIGN=\"center\"" : "");
  1844.     StaticTextHTML += (this.HasLookup ? " LOOKUP" : "");
  1845.     StaticTextHTML += ">";
  1846.     StaticTextHTML += this.Text;
  1847.     StaticTextHTML += "</DIV>";
  1848.     return StaticTextHTML;
  1849. }
  1850.  
  1851. // ============================================ \\
  1852. // ===         Form Heading Static          === \\
  1853. // ============================================ \\
  1854.  
  1855. function FormHeadingField(i_Name, i_Container)
  1856. {
  1857.     if (arguments.length > 0)
  1858.         this.initStatic(i_Name, i_Container);
  1859.  
  1860.     this.HeadingText = "";
  1861.     this.Center = false;
  1862.     this.Type = FormObjectType_FormHeading;
  1863. }
  1864.  
  1865. FormHeadingField.prototype = new Static;
  1866. FormHeadingField.prototype.getBody = function()
  1867. {
  1868.     var FormHeadingHTML = "<DIV";
  1869.     FormHeadingHTML += " CLASS=\"formHeading\"";
  1870.     FormHeadingHTML += " WIDTH=\"100%\"";
  1871.     FormHeadingHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1872.     FormHeadingHTML += " NAME=\"" + this.Name + "\"";
  1873.     FormHeadingHTML += " ID=\"" + this.Name + "\"";
  1874.     FormHeadingHTML += (this.IsHidden ? " ISHIDDEN" : "");
  1875.     FormHeadingHTML += (this.Center ? " ALIGN=\"center\"" : "");
  1876.     FormHeadingHTML += ">";
  1877.     FormHeadingHTML += this.HeadingText;
  1878.     FormHeadingHTML += "</DIV>";
  1879.     return FormHeadingHTML;
  1880. }
  1881.  
  1882. // ============================================ \\
  1883. // ===        Section Heading Static        === \\
  1884. // ============================================ \\
  1885.  
  1886. function SectionHeadingField(i_Name, i_Container)
  1887. {
  1888.     if (arguments.length > 0)
  1889.         this.initStatic(i_Name, i_Container);
  1890.  
  1891.     this.HeadingText = "";
  1892.     this.Center = false;
  1893.     this.Type = FormObjectType_SectionHeading;
  1894. }
  1895.  
  1896. SectionHeadingField.prototype = new Static;
  1897. SectionHeadingField.prototype.getBody = function()
  1898. {
  1899.     var SectionHeadingHTML = "<DIV";
  1900.     SectionHeadingHTML += " WIDTH=\"100%\"";
  1901.     SectionHeadingHTML += " CLASS=\"sectionHeading\"";
  1902.     SectionHeadingHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1903.     SectionHeadingHTML += " NAME=\"" + this.Name + "\"";
  1904.     SectionHeadingHTML += " ID=\"" + this.Name + "\"";
  1905.     SectionHeadingHTML += (this.IsHidden ? " ISHIDDEN" : "");
  1906.     SectionHeadingHTML += (this.Center ? " ALIGN=\"center\"" : "");
  1907.     SectionHeadingHTML += ">";
  1908.     SectionHeadingHTML += this.HeadingText;
  1909.     SectionHeadingHTML += "</DIV>";
  1910.     return SectionHeadingHTML;
  1911. }
  1912.  
  1913. // ============================================ \\
  1914. // ===        Horizontal Line Static        === \\
  1915. // ============================================ \\
  1916.  
  1917. function HorizontalLineField(i_Name, i_Container)
  1918. {
  1919.     if (arguments.length > 0)
  1920.         this.initStatic(i_Name, i_Container);
  1921.  
  1922.     this.Thickness = "";
  1923.     this.IsUnshaded = false;
  1924.     this.Type = FormObjectType_HorizontalLine;
  1925. }
  1926.  
  1927. HorizontalLineField.prototype = new Static;
  1928. HorizontalLineField.prototype.getBody = function()
  1929. {
  1930.     var HorizontalLineHTML = "<HR";
  1931.     HorizontalLineHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1932.     HorizontalLineHTML += " NAME=\"" + this.Name + "\"";
  1933.     HorizontalLineHTML += " ID=\"" + this.Name + "\"";
  1934.     HorizontalLineHTML += " SIZE=\"" + this.Thickness + "\"";
  1935.     HorizontalLineHTML += (this.IsHidden ? " ISHIDDEN" : "");
  1936.     HorizontalLineHTML += (this.IsUnshaded ? " NOSHADE" : "");
  1937.     HorizontalLineHTML += ">";
  1938.     return HorizontalLineHTML;
  1939. }
  1940.  
  1941. // ============================================ \\
  1942. // ===           New Line Static           === \\
  1943. // ============================================ \\
  1944.  
  1945. function NewLineField(i_Name, i_Container)
  1946. {
  1947.     if (arguments.length > 0)
  1948.         this.initStatic(i_Name, i_Container);
  1949.  
  1950.     this.Type = FormObjectType_NewLine;
  1951. }
  1952.  
  1953. NewLineField.prototype = new Static;
  1954. NewLineField.prototype.getBody = function()
  1955. {
  1956.     var NewLineHTML = "<BR";
  1957.     NewLineHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1958.     NewLineHTML += " NAME=\"" + this.Name + "\"";
  1959.     NewLineHTML += " ID=\"" + this.Name + "\"";
  1960.     NewLineHTML += (this.IsHidden ? " ISHIDDEN" : "");
  1961.     NewLineHTML += ">";
  1962.     return NewLineHTML;
  1963. }
  1964.  
  1965. // ============================================ \\
  1966. // ===            Button Static             === \\
  1967. // ============================================ \\
  1968.  
  1969. function ScriptButtonField(i_Name, i_Container)
  1970. {
  1971.     if (arguments.length > 0)
  1972.         this.initStatic(i_Name, i_Container);
  1973.  
  1974.     this.ButtonText = "";
  1975.     this.Center = false;
  1976.     this.OnClickScript = "";
  1977.     this.Type = FormObjectType_ScriptButton;
  1978. }
  1979.  
  1980. ScriptButtonField.prototype = new Static;
  1981. ScriptButtonField.prototype.getBody = function()
  1982. {
  1983.     var ScriptButtonHTML = "<BUTTON";
  1984.     ScriptButtonHTML += " CLASS=\"button\"";
  1985.     ScriptButtonHTML += " NAME=\"" + this.Name + "\"";
  1986.     ScriptButtonHTML += " ID=\"" + this.Name + "\"";
  1987.     ScriptButtonHTML += " TABINDEX=\"1\"";
  1988.     ScriptButtonHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1989.     ScriptButtonHTML += (this.IsHidden ? " ISHIDDEN" : "");
  1990.     ScriptButtonHTML += (this.Center ? " ALIGN=\"center\"" : "");
  1991.     ScriptButtonHTML += (this.OnClickScript != "" ? " ONCLICK=\"" + this.OnClickScript.replace(/\"/g, "'") + "\"" : "");
  1992.     if (g_IsSearch)
  1993.         ScriptButtonHTML += " DISABLED";
  1994.     ScriptButtonHTML += ">";
  1995.     ScriptButtonHTML += this.ButtonText;
  1996.     ScriptButtonHTML += "</BUTTON>";
  1997.  
  1998.     return ScriptButtonHTML;
  1999. }
  2000.  
  2001. // ============================================ \\
  2002. // ===             Image Static             === \\
  2003. // ============================================ \\
  2004.  
  2005. function ImageField(i_Name, i_Container)
  2006. {
  2007.     if (arguments.length > 0)
  2008.         this.initStatic(i_Name, i_Container);
  2009.  
  2010.     this.ID = -1;
  2011.     this.BorderSize = "";
  2012.     this.AltText = "";
  2013.     this.Center = false;
  2014.     this.Type = FormObjectType_Image;
  2015. }
  2016.  
  2017. ImageField.prototype = new Static;
  2018. ImageField.prototype.getBody = function()
  2019. {
  2020.     var ImageHTML = "<IMG";
  2021.     ImageHTML += " NAME=\"" + this.Name + "\"";
  2022.     ImageHTML += " ID=\"" + this.Name + "\"";
  2023.     ImageHTML += " SRC=\"" + getImageBindableURLByID(this.ID) + "\"";
  2024.     ImageHTML += " FIELDTYPE=\"" + this.Type + "\"";
  2025.     ImageHTML += (this.IsHidden ? " ISHIDDEN" : "");
  2026.     ImageHTML += " BORDER=\"" + this.BorderSize + "\"";
  2027.     ImageHTML += " TITLE=\"" + this.AltText + "\">";
  2028.  
  2029.     return ImageHTML;
  2030. }
  2031.  
  2032. // ============================================ \\
  2033. // ===            Unknown Static            === \\
  2034. // ============================================ \\
  2035.  
  2036. function UnknownField(i_Name, i_Container)
  2037. {
  2038.     if (arguments.length > 0)
  2039.         this.initStatic(i_Name, i_Container);
  2040.         
  2041.     this.Type = FormObjectType_Unknown;
  2042. }
  2043.  
  2044. UnknownField.prototype = new Static;
  2045. UnknownField.prototype.getBody = function()
  2046. {
  2047.     var UnknownHTML = "<DIV";
  2048.     UnknownHTML += " STYLE=\"border:2px solid black; padding:4px; background-color:white; color:black;\">";
  2049.     UnknownHTML += "An unknown field from a future version of Forms has been added to this form. Please upgrade to the latest version of Groove to enable the field '" + this.Name + "'.";
  2050.     UnknownHTML += "</DIV>";
  2051.     return UnknownHTML;
  2052. }
  2053.  
  2054. // ============================================ \\
  2055. // ===             Command Bar              === \\
  2056. // ============================================ \\
  2057.  
  2058. function CommandBar(i_FieldName, i_Width)
  2059. {
  2060.     this.Name = i_FieldName + "_commandbar";
  2061.     this.Width = i_Width;
  2062.     this.Commands = new Array();
  2063. }
  2064. CommandBar.prototype.addCommand = function (i_Command) { this.Commands.push(i_Command); }
  2065. CommandBar.prototype.addSeparator = function() { this.Commands.push(null); }
  2066. CommandBar.prototype.getBody = function ()
  2067. {
  2068.     var CommandBarHTML = '<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0" ID="' + this.Name + '" NAME="' + this.Name + '" STYLE="' + this.Width + '; height:16px;" CLASS="commandbar"><TR>';
  2069.  
  2070.     for (var i = 0; i < this.Commands.length; i++)
  2071.     {
  2072.         var objCommand = this.Commands[i];
  2073.         CommandBarHTML += '<TD';
  2074.  
  2075.         if (objCommand != null)
  2076.         {
  2077.             CommandBarHTML += ' CLASS="command"';
  2078.             CommandBarHTML += ' ID="' + objCommand.ID + '"';
  2079.             CommandBarHTML += ' TITLE="' + objCommand.Tooltip + '"';
  2080.             CommandBarHTML += ' ONCLICK="if (!this.getAttribute(\'COMMANDDISABLED\')) { ' + objCommand.Action + '; }"';
  2081.             CommandBarHTML += ' ONMOUSEOVER="commandMouseOver(this);"';
  2082.             CommandBarHTML += ' ONMOUSEOUT="commandMouseOut(this);"';
  2083.             CommandBarHTML += ' ONMOUSEDOWN="commandMouseDown(this);"';
  2084.             CommandBarHTML += ' ONMOUSEUP="commandMouseUp(this);">';
  2085.  
  2086.             CommandBarHTML += '<IMG';
  2087.             CommandBarHTML += ' SRC="' + objCommand.ImageURL + '"';
  2088.             CommandBarHTML += ' ID="' + objCommand.ID + 'Button"';
  2089.             CommandBarHTML += ' WIDTH="16"';
  2090.             CommandBarHTML += ' HEIGHT="16">';
  2091.         }
  2092.         else
  2093.         {
  2094.             CommandBarHTML += ' WIDTH="6">';
  2095.  
  2096.             CommandBarHTML += '<DIV';
  2097.             CommandBarHTML += ' CLASS="commandSep">';
  2098.             CommandBarHTML += '</DIV>';
  2099.         }
  2100.  
  2101.         CommandBarHTML += '</TD>';
  2102.     }
  2103.  
  2104.     CommandBarHTML += '<TD> </TD>';
  2105.     CommandBarHTML += '</TR></TABLE>';
  2106.     return CommandBarHTML;
  2107. }
  2108.  
  2109. function Command(i_ID, i_ImageURL, i_Tooltip, i_Action)
  2110. {
  2111.     this.ID = i_ID;
  2112.     this.ImageURL = i_ImageURL;
  2113.     this.Tooltip = i_Tooltip;
  2114.     this.Action = i_Action;
  2115. }
  2116.