Skip to content

Signature Form Cell

The SignatureFormCell Composable is a clickable FormCell that launches a signature capture prompt, such as SignatureCapture. This Composable highlights the purpose of the signature using a text label and provides an action button, typically labeled "Add Signature", which, when clicked, should launch the actual signature capture Composable.

In addition to its primary functionality, the SignatureFormCell provides various customization options. These include the ability to add helper text and modify styles, colors, text styles, and an error state for required form cells.

Signature Form Cell Example

Usage

Here's an example of how to integrate and use the SignatureFormCell Composable:

SignatureFormCell(
    onClick = {
        // Trigger the launch of SignatureCapture here
    },
    key = "Signature",
    value = "Job 394230",
    helperText = "Please provide your signature to confirm.",
    actionText = "Add Signature",
    isRequiredField = false,
)

In this example:

  • The purpose of the signature is labeled as "End-of-Day Confirmation".
  • The helperText offers additional context to the user about why the signature is needed.
  • Clicking on the Add Signature button should invoke the onClick callback, where you'd typically launch the SignatureCapture.
  • If the form cell is not marked as a required field, the error state will not be displayed if the cell is left empty.

Setting as a Required Field

To set the signature form cell as a required field, set isRequiredField to true.

SignatureFormCell(
    ...
    isRequiredField = true,
    isError = showError,
    onClick = {
        // Trigger the launch of SignatureCapture here for example:
    },
    submitted = false
)

Full Example of Implementing Signature Form Cell as a Required Field

Below is an example of how to implement a required signature form cell that tracks whether users submit their associated signatures.

var showDialog by rememberSaveable { mutableStateOf(false) }
var showError by rememberSaveable { mutableStateOf(false) }
var submitted by rememberSaveable { mutableStateOf(false) }
SignatureFormCell(
    key = "Required Signature",
    value = "Job 329032",
    helperText = "Will show error if signature is not filled.",
    onClick = {
        showDialog = true
    },
    isRequiredField = true,
    isError = showError,
    submitted = submitted
)
if (showDialog) {
    FioriSignatureCapture(
        onDismissRequest = {
            showDialog = false
            showError = true
        },
        onSubmit = { signatureInfo ->
            if (signatureInfo == null || signatureInfo.bitmap == null || !signatureInfo.isValid) {
                showError = true
            } else{
                showError = false
                submitted = true
                // Do something with the submitted signature here.
            }
            showDialog = false
        }
    )
}

Result:

Signature Form Cell Example

Signature Form Cell Example

Customization

SignatureFormCell provides a rich set of parameters for customizations:

  • key provides the key or label to the form cell, indicating its purpose.
  • actionText allows you to define the text of the action button.
  • helperText provides an option to add additional information or context to the form cell.
  • colors, styles, and textStyles give you the ability to tailor the appearance of the form cell to your design guidelines.

Last update: August 26, 2024