The Attach Content control (pxAttachContent) allows you to attach an image file to either a desktop application or to a mobile application that uses the Pega 7 mobile app. This control can be formatted to display to users as a button, link, or icon, and utilizes responsive UI for its file attachment screen, allowing it to conform to various UI sizes across any devices accessing the application.
Note that once the file attachment process has been activated for both desktop and mobile applications, users are unable to proceed until either attaching a file or canceling out of the attachment action.
Using the control
In a desktop application, using the Attach Content action displays the default file browser window, allowing users to select image files to attach to their application by either browsing in a local directory for a file or dragging and dropping files on to the attachment window. When using a desktop application, users can upload any image file type.
In a mobile application, using the Attach Content action displays a window with actions specific to each operating system:
- On iOS devices, users can select an image file from the mobile device's camera roll.
- On Android devices, users can select where to retrieve an image file from using a tiled list of applications, which includes the device's image gallery, Google Drive, Dropbox, and any other related file storage applications installed on the device.
The control also works on certain mobile browsers, such as Safari on iOS devices and Chrome on Android devices. Refer to the Platform Support Guide for a list of the mobile devices and browsers that support this control.
Configuring the control
Follow these steps to add pxAttachContent to your application:
- In Designer Studio, add a control from the menu to a section or layout.
- Click the Gear icon for the control to open the Cell Properties window.
- Next to the control name, click the Attach content.
Using the General tab
Once the control is configured to use Attach Content, use the fields on the General tab to specify how the control appears to users.
In the Content Type menu, select Image.
In both the File Name and Category fields, select Property Reference.
Selecting this option allows the control to use the correct context if present in a grid.
- For example, if there is a list of employees in a grid that states their name and job position, and an Attach content control is present in each row within the grid (or is user selectable), the corresponding value is used for each attachment performed within a row.
- Refer to the Pega 7 help documentation for more information on using attachment categories.
In themenu, select how to display this control: either as a button, link, or icon. Selecting one of these options causes additional fields to display for each respective choice:
Use the Button caption field to customize the text displayed if the Attach Content action is selected to display as a button.
See the Adding a Button control help topic for more information on configuring the control as a button.
Use the Link caption field to customize the text displayed if the Attach Content action is selected to display as a hyperlink.
See the Adding a Link control help topic for more information on configuring the control as a link.
Use the Icon source field to specify the location of the image shown to users if the Attach Content action is selected to display as an image or icon.
See the Adding an Icon/Image control help topic for more information on configuring the control as an icon/image.
Using the Presentation tab
Based on the selected UI element (button, link, or icon) in the Format Type field, the format is filtered accordingly on the Presentation tab.
Using the Actions tab
Any on-click actions set on the Actions tab are executed after a selected file is uploaded. Other events, such as "refresh action", can also be configured for the on-click action for this control, and are executed after the inherited behavior.