HTML¶
Overview¶
HTML panels have two main uses:
-
A simple form builder for creating complex forms & workflows that interact with other parts of the layout
-
A panel to use custom HTML within a layout
Fields¶
Autofill¶
In this example we will show how to use the Country field to populate the Country Code, Continent and Population field. We will use the Country table for this example.
First create a HTML Panel and add a 'Text' field attached to the Country Datamodel and choose Name (here the Name column contains Country names) as the display value:
Use the same method to add the other fields of interest (ie. Country Code, Continent, Population). Next we will add a button called 'Lookup' with the following script - when this button is clicked the remaining fields will populate based on the chosen Country.
This scripts uses a function called query to get the values corresponding to the chosen Country. When searching for a Country we also get a dropdown list of the Countries:
Performing a lookup on Belgium, we can see the other fields are populated:
Filtering Options¶
In this example we will use the Country table and create 3 select fields. The output of the first select field will be used in the WHERE clause to give the filtered selection of data which acts as the input of the second select field.
First we will create 3 select fields and call them Continent, Region and Country Name. Then create a blender on the Country datamodel called CountryFiltered and insert the following snippet:
Here the continent.getValue()
and region.getValue()
gets the value in the select field named Continent and Region respectively.
Next we will set up the three fields as shown below. We get the relevant data from the CountryFiltered datamodel.
Finally, in order for the select field options to update each time we select a different Continent or Region, we will need to reprocess the datamodel. Thus for the Continent and Region select field, add the following AMI Script: