var inputParameters = application.ADF.data.duplicateStruct(arguments.parameters);
var currentValue = arguments.value; // the field's current value
var readOnly = (arguments.displayMode EQ 'readonly') ? true : false;
var cols = 'FORMNAME,ID,STATE';
var customElementQry = QueryNew(cols);
var simpleFormQry = QueryNew(cols);
var combinedCols = cols & ',TYPE';
var combinedFormQry = QueryNew(combinedCols);
inputParameters = setDefaultParameters(argumentCollection=arguments);
if ( ListFindNoCase(inputParameters.includedFormTypes,'custom',",") )
customElementQry = application.ADF.ceData.getAllCustomElements();
if ( ListFindNoCase(inputParameters.includedFormTypes,'simple',",") )
simpleFormQry = getAllSimpleForms();
combinedFormQry = combineFormQrys(ceQry=customElementQry,simpleQry=simpleFormQry);
var inputParameters = application.ADF.data.duplicateStruct(arguments.parameters);
// Validate if the property field has been defined
if ( NOT StructKeyExists(inputParameters, "fldID") OR LEN(inputParameters.fldID) LTE 0 )
inputParameters.fldID = arguments.fieldName;
// Make "custom" active is nothing is selected
if ( NOT StructKeyExists(inputParameters, "includedFormTypes") OR LEN(TRIM(inputParameters.includedFormTypes)) EQ 0 )
inputParameters.includedFormTypes = "custom";
return inputParameters;
private any function getValidationJS(required string formName, required string fieldName, required boolean isRequired)
{
if (arguments.isRequired)
return 'hasValue(document.#arguments.formName#.#arguments.fieldName#, "TEXT")';
return "";
}
private string function getValidationMsg()
{
return "Please select a value for the #arguments.label# field.";
}
public string function getResourceDependencies()
{
return listAppend(super.getResourceDependencies(), "jQuery");
}
public void function loadResourceDependencies()
{
application.ADF.scripts.loadJQuery(noConflict=true);
}
var retQry = QueryNew("FORMNAME,ID,STATE");
var csObj = Server.CommonSpot.ObjectFactory.getObject("SimpleFormElement");
var simpleFormQry = csObj.getList();
//writedump(var=simpleFormQry,expand=false,label="simpleFormQry")
select FORMNAME, FormID As ID, '0' AS STATE
from simpleFormQry
return retQry;
var newCols = 'FORMNAME,ID,STATE,TYPE';
var retQuery = QueryNew(newCols);
var newQuery = QueryNew(newCols);
var colName = '';
var colVal = '';
var r = 1;
var s = 1;
var c = 1;
var b = 1;
// Loop over the custom element records
for ( r=1; r LTE arguments.ceQry.RecordCount; r++ ) {
queryAddRow(newQuery);
for ( c=1; c LTE ListLen(newCols); c++ ) {
colName = UCASE(ListGetAt(newCols,c));
if ( !StructKeyExists(arguments.ceQry,colName) )
{
if ( colName EQ "TYPE" )
colVal = 'custom element';
else
colVal = '';
}
else
colVal = arguments.ceQry[colName][r];
QuerySetCell(newQuery, colName, colVal, r);
}
}
// Loop over the simple form records
for ( s=1; s LTE arguments.simpleQry.RecordCount; s++ ) {
queryAddRow(newQuery);
for ( b=1; b LTE ListLen(newCols); b++ ) {
colName = UCASE(ListGetAt(newCols,b));
if ( !StructKeyExists(arguments.simpleQry,colName) )
{
if ( colName EQ "TYPE" )
colVal = 'simple form';
else
colVal = '';
}
else
colVal = arguments.simpleQry[colName][s];
QuerySetCell(newQuery, colName, colVal, s);
}
}
select #newCols#
from newQuery
where FORMNAME <> '' and FORMNAME IS NOT NULL
order by TYPE asc, FORMNAME asc
return retQuery;