application.ADF.scripts.loadJQuery(noConflict=true); application.ADF.scripts.loadJQueryUI(); // Variable for the version of the field - Display in Props UI. fieldVersion = "2.0.15"; // CS version and required Version variables requiredCSversion = 10; csVersion = ListFirst(ListLast(request.cp.productversion," "),".");
This Custom Field Type requires CommonSpot #requiredCSversion# or above.
// initialize some of the attributes variables typeid = attributes.typeid; prefix = attributes.prefix; formname = attributes.formname; formID = attributes.formID; currentValues = attributes.currentValues; // AjaxProxy Path to make ajax call in context of the site ajaxComURL = application.ADF.ajaxProxy; ajaxBeanName = 'customElementDataManager'; if( not structKeyExists(currentValues, "childCustomElement") ) currentValues.childCustomElement = ""; if( not structKeyExists(currentValues, "parentUniqueField") ) currentValues.parentUniqueField = ""; if( not structKeyExists(currentValues, "childUniqueField") ) currentValues.childUniqueField = ""; if( not structKeyExists(currentValues, "childLinkedField") ) currentValues.childLinkedField = ""; if( not structKeyExists(currentValues, "inactiveField") ) currentValues.inactiveField = ""; if( not structKeyExists(currentValues, "inactiveFieldValue") ) currentValues.inactiveFieldValue = ""; if( not structKeyExists(currentValues, "displayFields") ) currentValues.displayFields = ""; if( not structKeyExists(currentValues, "widthValue") ) currentValues.widthValue = ""; if( not structKeyExists(currentValues, "widthUnit") ) currentValues.widthUnit = ""; if( not structKeyExists(currentValues, "heightValue") ) currentValues.heightValue = ""; if( not structKeyExists(currentValues, "heightUnit") ) currentValues.heightUnit = ""; if( not structKeyExists(currentValues, "sortByType") ) currentValues.sortByType = ""; if( not structKeyExists(currentValues, "sortByField") ) currentValues.sortByField = ""; if( not structKeyExists(currentValues, "sortByDir") ) currentValues.sortByDir = ""; if( not structKeyExists(currentValues, "positionField") ) currentValues.positionField = ""; if( not structKeyExists(currentValues, "assocCustomElement") ) currentValues.assocCustomElement = ""; if( not structKeyExists(currentValues, "secondaryElementType") ) currentValues.secondaryElementType = "CustomElement"; if( not structKeyExists(currentValues, "interfaceOptions") ) currentValues.interfaceOptions = "existing,EditAssoc,delete"; if( not structKeyExists(currentValues, "compOverride") ) currentValues.compOverride = ""; if( not structKeyExists(currentValues, "parentInstanceIDField") ) currentValues.parentInstanceIDField = ""; if( not structKeyExists(currentValues, "childInstanceIDField") ) currentValues.childInstanceIDField = ""; if( not structKeyExists(currentValues, "newOptionText") ) currentValues.newOptionText = ""; if( not structKeyExists(currentValues, "existingOptionText") ) currentValues.existingOptionText = ""; if( not structKeyExists(currentValues, "editAssocOptionText") ) currentValues.editAssocOptionText = ""; if( not structKeyExists(currentValues, "editChildOptionText") ) currentValues.editChildOptionText = ""; if( not structKeyExists(currentValues, "deleteOptionText") ) currentValues.deleteOptionText = ""; if( not structKeyExists(currentValues, "passthroughParams") ) currentValues.passthroughParams = ""; // UI changed to provide the JOIN as a single field instead of child and assoc. So added logic to properly select the join and secondary elements according to the data stored for DB joinObj = ''; secondaryObj = ''; if (IsNumeric(currentValues.assocCustomElement)) { joinObj = currentValues.assocCustomElement; secondaryObj = currentValues.childCustomElement; } else joinObj = currentValues.childCustomElement; if (NOT IsNumeric(currentValues.assocCustomElement)) { if (ListFindNoCase(currentValues.interfaceOptions, 'new')) { currentValues.interfaceOptions = ListSetAt(currentValues.interfaceOptions, ListFindNoCase(currentValues.interfaceOptions,'new'), 'existing'); currentValues.existingOptionText = currentValues.newOptionText; currentValues.newOptionText = ""; } if (ListFindNoCase(currentValues.interfaceOptions, 'editChild')) { currentValues.interfaceOptions = ListSetAt(currentValues.interfaceOptions, ListFindNoCase(currentValues.interfaceOptions,'editChild'), 'editAssoc'); currentValues.editAssocOptionText = currentValues.editChildOptionText; currentValues.editChildOptionText = ""; } } parentElementType = ''; parentFormLabel = ''; fieldsMethod = "getFields"; fieldsArgs = StructNew(); infoMethod = "getInfo"; infoArgs = StructNew(); isDataManagerEnabled = 1; switch (dlgtype) { case 'customelement': parentElementType = 'CustomElement'; infoArgs.elementID = formID; fieldsArgs.elementID = formID; break; case 'metadata': parentElementType = 'MetadataForm'; infoMethod = "getForms"; infoArgs.id = formID; fieldsArgs.formID = formID; break; case 'simpleform': isDataManagerEnabled = 0; } customElementObj = Server.CommonSpot.ObjectFactory.getObject('CustomElement'); metadataFormObj = Server.CommonSpot.ObjectFactory.getObject('MetadataForm'); if (parentElementType EQ 'MetadataForm') parentFormObj = metadataFormObj; else parentFormObj = customElementObj; allMetadataForms = metadataFormObj.getForms(); allCustomElements = customElementObj.getList(type="All", state="Active"); errorMsgCustom = 'Some error occurred while trying to perform the operation.'; if (parentElementType EQ 'MetadataForm') parentFormLabel = parentFormDetails.formName; else parentFormLabel = parentFormDetails.Name; SELECT ID, Name, LOWER(Type) AS Type FROM allCustomElements UNION ALL SELECT ID, CAST(FormName AS VARCHAR) AS Name, 'metadataform' AS Type FROM allMetadataForms SELECT * FROM allCustomElements WHERE lower(Type) = SELECT ID, Label AS Name FROM selectedTypeFields WHERE style="display:none;"> secondaryObjIsNotGlobal = secondaryObj == "" || selectedSecondaryCEType != "global"; parentIsMetadataForm = parentElementType == "MetadataForm"; interfaceOptionsChecked = {}; interfaceOptionFields = listToArray("new,existing,editAssoc,editChild,delete,disableDatamanager"); interfaceOptionFieldCount = arrayLen(interfaceOptionFields); for (i = 1; i <= interfaceOptionFieldCount; i++) interfaceOptionsChecked[interfaceOptionFields[i]] = listFindNoCase(currentValues.interfaceOptions, interfaceOptionFields[i]) > 0; style="display:none;"> style="display:none;"> style="display:none;"> style="display:none;">
Primary Object: #parentFormLabel#
Joining Custom Element:
  This is the custom element that contains the relationship between the object(s). It may contain other data as well.
Secondary Object:
Interface Options: #Server.CommonSpot.udf.tag.checkboxRadio(type="checkbox", name="#prefix#interfaceOptionsCbox", value="existing", label="Allow Add Existing", labelIsHTML=1, checked=interfaceOptionsChecked.existing, labelClass="cs_dlgLabelSmall", onclick="#prefix#toggleInputField(this,'existing');")# 
style="display:none;padding-left:50px;"style="padding-left:50px;">Button Text: #Server.CommonSpot.udf.tag.input(type="text", id="#prefix#existingOptionText", name="#prefix#existingOptionText", value="#currentValues.existingOptionText#", size="30", class="InputControl")#
style="display:none;">#Server.CommonSpot.udf.tag.checkboxRadio(type="checkbox", name="#prefix#interfaceOptionsCbox", value="new", label="Allow Add New", labelIsHTML=1, checked=interfaceOptionsChecked.new, labelClass="cs_dlgLabelSmall", onclick="#prefix#toggleInputField(this,'new');")# 
style="display:none;padding-left:50px;"style="padding-left:50px;">Button Text: #Server.CommonSpot.udf.tag.input(type="text", id="#prefix#newOptionText", name="#prefix#newOptionText", value="#currentValues.newOptionText#", size="30", class="InputControl")#
#Server.CommonSpot.udf.tag.checkboxRadio(type="checkbox", name="#prefix#interfaceOptionsCbox", value="editAssoc", label="Allow Edit", labelIsHTML=1, checked=interfaceOptionsChecked.editAssoc, labelClass="cs_dlgLabelSmall", onclick="#prefix#toggleInputField(this,'editAssoc');")# 
style="display:none;padding-left:50px;"style="padding-left:50px;">Hover Text: #Server.CommonSpot.udf.tag.input(type="text", id="#prefix#editAssocOptionText", name="#prefix#editAssocOptionText", value="#currentValues.editAssocOptionText#", size="30", class="InputControl")#
style="display:none;">#Server.CommonSpot.udf.tag.checkboxRadio(type="checkbox", name="#prefix#interfaceOptionsCbox", value="editChild", label="Allow Edit", labelIsHTML=1, checked=interfaceOptionsChecked.editChild, labelClass="cs_dlgLabelSmall", onclick="#prefix#toggleInputField(this,'editChild');")# 
style="display:none;padding-left:50px;"style="padding-left:50px;">Hover Text: #Server.CommonSpot.udf.tag.input(type="text", id="#prefix#editChildOptionText", name="#prefix#editChildOptionText", value="#currentValues.editChildOptionText#", size="30", class="InputControl")#
#Server.CommonSpot.udf.tag.checkboxRadio(type="checkbox", name="#prefix#interfaceOptionsCbox", value="delete", label="Allow Delete", labelIsHTML=1, checked=interfaceOptionsChecked.delete, labelClass="cs_dlgLabelSmall", onclick="#prefix#toggleInputField(this,'delete');")# 
style="display:none;padding-left:50px;"style="padding-left:50px;">Hover Text: #Server.CommonSpot.udf.tag.input(type="text", id="#prefix#deleteOptionText", name="#prefix#deleteOptionText", value="#currentValues.deleteOptionText#", size="30", class="InputControl")#
#Server.CommonSpot.udf.tag.checkboxRadio(type="checkbox", name="#prefix#interfaceOptionsCbox", value="disableDatamanager", label="Disable Data Manager until initial save", labelIsHTML=1, title="Unchecking this option may cause records which are added via Data manager to be orphaned if the initial Save of the parent custom element is cancelled", checked=(parentIsMetadataForm || interfaceOptionsChecked.disableDatamanager), labelClass="cs_dlgLabelSmall", disabled=parentIsMetadataForm)# 
Display Fields:
Available Fields:
Fields to Display:
Grid Dimensions:
Width: #Server.CommonSpot.udf.tag.input(type="text", id="#prefix#widthValue", name="#prefix#widthValue", value="#currentValues.widthValue#", size="5", class="InputControl")# Height: #Server.CommonSpot.udf.tag.input(type="text", id="#prefix#heightValue", name="#prefix#heightValue", value="#currentValues.heightValue#", size="5", class="InputControl")#
Use px width to ensure that the form is at least the requested width.
Display Order:
#Server.CommonSpot.udf.tag.checkboxRadio(type="radio", name="#prefix#sortByType", value="auto", label="Sort By", checked=(currentValues.sortByType EQ '' OR currentValues.sortByType EQ 'auto'), labelClass="cs_dlgLabelSmall", onchange="#prefix#selectRadio(0)")#   
#Server.CommonSpot.udf.tag.checkboxRadio(type="radio", name="#prefix#sortByType", value="manual", label="Order Manually", checked=(currentValues.sortByType EQ 'manual'), labelClass="cs_dlgLabelSmall", onchange="#prefix#selectRadio(1)")# 
style="display:none;margin-left:40px;"style="margin-left:40px;" class="cs_dlgLabelSmall">Position Field: 
Only 'Number (integer)' or 'Hidden' fields can be used to Order Manually.
Component Override: #Server.CommonSpot.udf.tag.input(type="text", id="#prefix#compOverride", name="#prefix#compOverride", value="#currentValues.compOverride#", size="70", class="InputControl")#
Passthrough Params: #Server.CommonSpot.udf.tag.input(type="text", id="#prefix#passthroughParams", name="#prefix#passthroughParams", value="#currentValues.passthroughParams#", size="70", class="InputControl")#
  Optional comma-delimited list of Form or URL fields to pass through to dialogs invoked when the user presses either of the 'Add New' buttons.
#parentFormLabel#

Unique Field: CommonSpot ID #Server.CommonSpot.UDF.tag.input(type="hidden", name="#prefix#parentUniqueField", value="{{pageid}}")#
#selectedJoinCEName#

Unique Field:
Linkage Field:
#parentFormLabel# InstanceID Field:
#selectedSecondaryCEName# InstanceID Field:
Inactive Field:   style="display:none;">Inactive Value: #Server.CommonSpot.udf.tag.input(type="text", id="#prefix#inactiveFieldValue", name="#prefix#inactiveFieldValue", value="#currentValues.inactiveFieldValue#", size="10", class="InputControl")#
#selectedSecondaryCEName#

Unique Field:

ADF Custom Field v#fieldVersion#
#Server.CommonSpot.UDF.tag.input(type="hidden", name="#prefix#displayFields", value=currentValues.displayFields)# #Server.CommonSpot.UDF.tag.input(type="hidden", name="#prefix#assocCustomElement", value=secondaryObj)# #Server.CommonSpot.UDF.tag.input(type="hidden", name="#prefix#childCustomElement", value=joinObj)# #Server.CommonSpot.UDF.tag.input(type="hidden", name="#prefix#secondaryElementType", value=currentValues.secondaryElementType)# #Server.CommonSpot.UDF.tag.input(type="hidden", name="#prefix#interfaceOptions", value=currentValues.interfaceOptions)# #Server.CommonSpot.UDF.tag.input(type="hidden", name="#prefix#childUniqueField", value=currentValues.childUniqueField)#
This field type could be configured for custom elements and metadata forms only.