Several Custom Fields: Special Control Types support multi-step configuration when building a custom field in SmartSimple. Create a Special - Button to open a target page in a modal window, a new tab, or the same window. Use a Special - Browser Script to total the values of a dynamic custom field. Configure a Special - Web Page View to append stored PDF documents to its output and generate a PDF automatically. For more information, see Custom Fields: Special Control Types Settings Reference.
Who: Global administrators
When to Use Custom Fields: Special Control Types
Use Special Control Types when:
- A special control field needs behavior beyond its basic settings.
- A Special - Button fits a record that needs a button to open a profile, a grid, or a new record.
- A Special - Browser Script fits a form that must total repeated values.
- PDF attachment and automatic PDF generation fit a Special - Web Page View used to produce documents.
Create a Special - Button Custom Field
A Special - Button Custom Field opens a target page in the same window, a new tab, or a modal window when it is activated.
To create a Special - Button Custom Field:
- Click the Menu icon in the upper navigation bar, and then select the relevant UTA/module from the Applications drop-down menu.
- Click the Configuration Settings gear.
- Click the relevant Level 1, Level 2, or Level 3 tab.
- Locate the General Settings section and click Custom Fields.
- Click the New Field [+] button.
- Click the Field Type field and select Special - Button from the drop-down menu.
- Click the Caption field and enter the applicable information.
- Locate the URL field and click the URL Lookup [binoculars] icon.
- Locate the Open in field and click the applicable option.
- Click Main Window to open the object and replace the current content.
- Click Modal Window to open the object in an overlay above the current content.
- Click New Tab to open the object in the Tab Bar at the bottom of the page.
- Click the Confirmation Message field and add text to present a custom message before the target opens.
- For example, a message is appropriate when the button redirects the user away from a page that may have unsaved changes.
- This field is optional.
- Locate the Caption Location field and click the applicable option.
- Click No Caption to align the button to the left of the record without a caption.
- Click the Button Label field and add the text to appear on the button.
- Click the Icon Style field and select a style from the drop-down menu.
- This field is optional.
- Click the Icon field and select the applicable icon.
- Icons are positioned to the left of the button label text.
- This field is optional.
- Click the Tool Tip or Instructions field and enter the applicable information to provide additional context.
- These fields are optional.
- Click the Permissions & Availability tab and set the applicable permissions, and then click Save.
Sum a Dynamic Custom Field with a Special - Browser Script
Summing a dynamic custom field requires three custom fields: a Text Box - Text Single Line field to store the total, a Special - Browser Script field to run the calculation, and the Dynamic Data - Dynamic Control Field being totaled. Place two of the fields before the dynamic custom field, using a smaller display order, and place the third field within the dynamic custom field. For example, if the dynamic custom field has a display order of 2050, the two preceding fields must use a smaller display order, such as 2045 and 2047.
Create a Text Box Field
To create a Text Box - Text Single Line custom field:
- Click the Menu icon in the upper navigation bar, and then select the relevant UTA/module from the Applications drop-down menu.
- Click the Configuration Settings gear.
- Click the relevant Level 1, Level 2, or Level 3 tab.
- Locate the General Settings section and click Custom Fields.
- Click the New Field [+] button.
- Click the Field Type field and select Text Box - Text Single Line from the drop-down menu.
- This field stores the total. Note its Field ID, which appears in the List View on the Custom Fields page.
- Complete the applicable fields, and then click Save. See the Special - Browser Script section in Custom Fields: Special Control Types Settings Reference.
Create a Special - Browser Script Field
To create a Special - Browser Script custom field:
- Click the Menu icon in the upper navigation bar, and then select the relevant UTA/module from the Applications drop-down menu.
- Click the Configuration Settings gear.
- Click the relevant Level 1, Level 2, or Level 3 tab.
- Locate the General Settings section and click Custom Fields.
- Click the New Field [+] button.
- Click the Field Type field and select Special - Browser Script from the drop-down menu.
- Click the Custom Script field and add the following script.
- Replace xxxxxx with the Field ID of the Text Box - Text Single Line custom field.
//Set the field that stores the total to read only
document.frmevent.cf_xxxxxx.readOnly=true;
//Take the value of the passed in field and add it to the total sum.
function addTotal(valuetxt,index)
{
// if the index is equal to 1 then reset the sum value to zero
if (index == 1 )
document.frmevent.cf_xxxxxx.value=0;
//update the value
document.frmevent.cf_xxxxxx.value = parseFloat(document.frmevent.cf_xxxxxx.value) + parseFloat(valuetxt);
}- Complete the applicable fields, and then click Save. See the Special - Browser Script section in Custom Fields: Special Control Types Settings Reference.
Edit the Dynamic Data - Dynamic Control Field
To edit the Dynamic Data - Dynamic Control Field:
- Click the edit [pencil] icon next to the Dynamic Data - Dynamic Control Field.
- Create a new sub field, click the Field Type field, and then select Special - Browser Script.
- Click the Custom Script field and add the following script.
- Replace xxxxx1 with the Field ID of the dynamic custom field, and replace xxxxx2 and xxxxx3 with the Field IDs of the fields to total.
var expenseCF = new Array('cf_xxxxx1', 'cf_xxxxx2', 'cf_xxxxx3');
var i = 0;
var number = eval("document.frmevent."+ expenseCF[0] + ".value;");
number = parseInt(number);
for (i = 1; i <= number; i++)
{
var valuetxt = eval("document.frmevent."+ expenseCF[i] + ".value;");
if (valuetxt != undefined)
{ //Call the function addTotal so that it adds the sum together
addTotal(valuetxt,i);
}
}Attach PDFs to a Web Page View Output
A Special - Web Page View can append one or more PDF documents, stored in a file field or SmartFolder, to its output using ssattach. Attached PDFs appear only when the output is generated as a PDF, and they do not appear in HTML preview mode.
To attach a PDF to the output:
- Click the Menu icon in the upper navigation bar, and then select the relevant UTA/module from the Applications drop-down menu.
- Click the Configuration Settings gear.
- Click the relevant Level 1, Level 2, or Level 3 tab.
- Locate the General Settings section and click Custom Fields.
- Click the New Field [+] button.
- Click the Field Type field and select Special - Web Page View from the drop-down menu.
- Locate the HTML Template field and click SmartFields Sample Template.
- Add an ssattach tag where the PDF should appear, setting the position to before or after and the location to a Smart Folder path, a single file custom field, a multiple files custom field, or a parent field reference.
- Complete the remaining applicable fields, and then click Save. See the Special - Web Page View section in Custom Fields: Special Control Types Settings Reference.
For example, the following tag appends a Smart Folder PDF before the Web Page View content:
<!--@ssattach(before;/files/1234/123/myfile.pdf)-->
The following tag appends a PDF from a single file custom field named AttachPDFFile:
<!--@ssattach(before;@AttachPDFFile.value@)-->
Generate PDF Output Automatically from a Web Page View
A Special - Web Page View can generate PDF output without the user clicking Export as PDF.
To generate PDF output automatically:
- Click the Menu icon in the upper navigation bar, and then select the relevant UTA/module from the Applications drop-down menu.
- Click the Configuration Settings gear.
- Click the relevant Level 1, Level 2, or Level 3 tab.
- Locate the General Settings section and click Custom Fields.
- Click the New Field [+] button.
- Click the Field Type field and select Special - Web Page View from the drop-down menu.
- Locate the HTML Template field and click SmartFields Sample Template.
- Add the following script at the end of the source.
<script language="javascript"> parent.pdfwrite(); </script>
- Complete the remaining applicable fields, and then click Save. See the Special - Web Page View section in Custom Fields: Special Control Types Settings Reference.