Passing data using inputs
Often, you need to transfer or pass data between s to provide context and data, for example, when pressing on a customer in a list, the customer ID is passed to the order form, pre-populating the customer's details. This is accomplished by utilizing inputs and outputs.
The input data is configured in one of the following:
- In the index.jigx file under each 's input property.
- In another under the parameters property.
You can define the following for inputs:
- The data type
- Whether the input is required or not
- A default value if no input is provided.
Properties | Values |
---|---|
default | Add a value that will display as the default if nothing is specified. This property is optional. |
required |
|
type | string - input must be of type string, for example, Mary. |
| object - input must be an object with properties defined.
|
| array - input must be an array.
The YAML format for specifying the array can be one of the following:
|
| boolean - input must be true or false. |
| number - input must be of type number, for example, 45 or 350.88. |
- You can specify a default value that can be used as a placeholder if no input value is found in the configuration. Use the default property when defining the input types.
- With inputs, parameters are configured in the first (sending ) with the input used in the receiving .
- The parameter and input work in conjunction with each other.
- The parameter requires a parameterName and a data value that is available in that .
- Multiple parameters can be passed through at once.
- The receiving configuration uses the format [email protected]. Use IntelliSense (ctrl+space) to assist with configuration.
- In a , you can access all data sent from other s using the expression @ctx.jig.inputs.[parameter], for example, [email protected][customerId = @ctx.jig.inputs.customerId]
- If you are in a list-item component, you don't need to list all the parameters, simply use: parameters: customer: [email protected]
Jig input definitions are configured directly in the and the input values are defined in the index.jigx file. The values from the index file are directly returned to the .
Jig input definitions are configured directly in the and the input values returned from components configured in another . In the example below a form captures the student details, the Student Details form links to the Student Card and uses parameters to pass the values required in the Student Card inputs.