The Form UDR
is used to create a form that includes other components where you can enter data to be sent to workflow.
...
You can use the following APL code to create a form as shown above:
Code Block |
---|
//Create the Form UDR
Form searchform = udrCreate(Form);
searchform.method = searchform.METHOD_POST;
//Create the textfield to be included in the form.
TextField searchText = udrCreate(TextField);
searchText.id = "search";
//Must include name otherwise the data can not be sent to workflow
searchText.name = "search";
searchText.placeholder = "Filter Results";
//Create the send button
Button searchButton = udrCreate(Button);
searchButton.buttonType = searchButton.SUBMIT;
searchButton.text = "Search";
//Add the components to the form
searchform.components = listCreate(ComponentUDR, searchText, searchButton); |
Another example of a form that uses a grid to place the components.
...
The APL code to produce the above example is this:
Expand | ||
---|---|---|
| ||
|
Code Block |
---|
// Helper functions for column and row
GridColumn getColumn(ComponentUDR comp, int width){
GridColumn col = udrCreate(GridColumn);
if(width > 0){
col.width = width;
}
col.components = listCreate(ComponentUDR, comp);
return col;
}
GridRow getRow(list<GridColumn> columns){
GridRow row = udrCreate(GridRow);
row.columns = listCreate(GridColumn);
for (GridColumn column: columns) {
listAdd(row.columns, column);
}
return row;
} |
The following fields are included in the Form UDR
:
Field | Description |
---|---|
action (string) | This field may contain a string that specifies where to send the form data when a form is submitted.
|
attributes (map<string,string>) | This field may contain extra attributes to be added. |
components (list<ComponentUDR>) | This field may contain a list of child components, the components that will produce the form data. They can be added direct in the list or inside a Grid UDR and then the Grid UDR is added here. |
cssClasses (list<string>) | This field may contain a list of extra values added to class attribute. This is typically used to style the component. Please read more on Bootstrap. |
encoding (string) | This field may contain may a string for encoding. Some constants is added to help: |
id (string) | This field may contain the id of the component |
method (int) | This field may contain method used to submit the form. Possible values are: |
name (string) | This field may contain the name of the component |