XForms Module Widget Properties Pane
The Widget Properties Pane displays a list of properties, as listed below, for the selected widget on the design surface and allows you to edit them.
Text
The display text or caption of the widget. This is used for widgets like Labels, Check Boxes, Radio Buttons.
Tooltip
Text which gets displayed when on hovers the mouse of the widget.
Binding
The question which is attached to the selected widget. You can just start typing and then a list of available questions, that start with your typed character, will be displayed for you to chose from. When widgets are first loaded, this is automatically set for you. So it will be rare for you to have to change this value.
Child Binding
This is supposed to be the value of one of the allowed options or answers for the question selected in the binding property above. This is used only for radio buttons, check boxes, Browse and Clear buttons for multimedia. This will also prompt for an appropriate selection if the options are part of the original schema. For coded fields which do not have a predefined list of options in the schema, child items can be added in the profile tab with bindings including standard HL-7 messages such as 123^Concept Name^99DCT.
Width
The width of the selected widget in pixels. You can type any numeric value.
Height
The height of the selected widget in pixels. You can type any numeric value.
Enabled
When it's true, it's shown but locked.
Visible
When it's true, it's shown.
Left
The left position of the selected widget in pixels. You can type any numeric value.
Top
The top position of the selected widget in pixels. You can type any numeric value.
Tab Index
The tab navigation order index of the selected widget. You can type any valid numeric value. Widgets at the same level (e.g in same group box) should have unique tab index values. If you give the same navigation index to more than one widget at the same level, only one of them will be displayed.
Repeat
You will rarely need to set this value as it is automatically given the appropriate value. It has a value of true for group boxes containing widgets which are to be repeated for various rows of answers for the same question. An example of this is problem lists or list of diagnosis.
External Source
This is used for widgets whose allowed value are not part of the form but instead come from some other place. An example is where you drop a logo field widget onto the design surface and use this external source property to set the image url like: images/openmrs_logo_short.gif
Another example is when you need to search concepts from the concept dictionary. In this case the value of this field will be: "concept" without the quotes.
Searching for locations, providers, and persons/patients would require the external source values of location, provider, and person respectively.
Another example would be when you have a special table to contain the list of possible values. In this case the value of this field would be the table name.
Example of provider search with specific role(s): A sql query to specify the roles you would like to include. In this example, it will only display providers whose roles are "Provider" or "Consultant Physician".
select u.user_id, concat(pn.given_name, " ", pn.middle_name, " ", pn.family_name, " ", u.user_id) as name from users u inner join person_name pn on u.person_id=pn.person_id inner join user_role ur on ur.user_id=u.user_id where ur.role in ('Provider', 'Consultant Physician')
Display Field
This is used for widgets whose allowed value are not part of the form but instead come from some other place. You do not need to always have a value in this field as it may not be needed. For instance of you want to search the concept dictionary this field should be left blank. But when you have value coming from a database table, this will be the name of the column whose values are used for displaying.
Value Field
This is used for widgets whose allowed value are not part of the form but instead come from some other place. You do not need to always have a value in this field as it may not be needed. For instance of you want to search the concept dictionary this field should be left blank. But when you have value coming from a database table, this will be the name of the column whose values are to be saved with form data after a selection.
Filter Field
This can used to restrict concept search results by entering the name of concept class that you want. If you need more than one concept class for the same widget, you can separate them with commas. If you want all concepts without filtering them, then just leave this field empty.
For instance after entering a value of concept for the External Source widget property:
To search drugs the Filter Field value is: Drug
To search diagnosis the Filter Field value is: Diagnosis
To search for both drugs and diagnosis the Filter Field value is: Drug,Diagnosis
NOTE: For multiple filter values, do not include any space before or after the comma. For instance the above should not be: Drug, Diagnosis
Another use of the Filter Field property is for specifying the database field used to filter values from a table. For lists that you do not need to filter, just leave this field empty.
Here is an example:
Assuming i have a table called "lookup_table" with this structure and values
id name parent_id
h4. h4. h4. h4. h2. =
1 Africa
2 Asia
3 Europe
4 East Africa 1
5 West Africa 1
6 Central Africa 1
7 Uganda 4
8 Kenya 4
9 Tanzania 4
10 Nigeria 5
11 Togo 5
Assuming i have three questions on my form:
Continent = Single Select => WIDGET PROPERTIES (External Source=lookup_table, Display Field=name, Value Field=id, Filter Field=parent_id)
Region = Single Select Dynamic => WIDGET PROPERTIES (External Source=lookup_table, Display Field=name, Value Field=id, Filter Field=parent_id)
Country = Single Select Dynamic => WIDGET PROPERTIES (External Source=lookup_table, Display Field=name, Value Field=id, Filter Field=parent_id)
Font Family h2. The font family of the selected widget. You can type any valid html font name or just chose one of the available names from a list which will only get displayed when you start typing. Fore Color h2. The fore color of the selected widget. You can type any valid html color code or just chose one of the available colors from a list which will only get displayed when you start typing. Font Weight h2. The font weight for the selected widget. You can chose one from the drop down list. Font Style h2. The font style for the selected widget. You can chose one from the drop down list. Font Size h2. The font size for the selected widget. You can type any number for the size you want. Text Decoration h2. The decoration of text for the selected widget. You can chose one from the drop down list. Text Align h2. The alignment position of text for the selected widget. You can chose one from the drop down list. Background Color h2. The background color of the selected widget. You can type any valid html color code or just chose one of the available colors from a list which will only get displayed when you start typing. Border Style h2. The border style of the selected widget. You can chose one from the drop down list. Border Width h2. The border width of the selected widget. You can type any number for the width you want. Border Color h1. =
The border color of the selected widget. You can type any valid html color code or just chose one of the available colors from a list which will only get displayed when you start typing. Resources ==
Below is another example:
Supposing you have these database tables with the following fields:
countries: name, country_id
states: name, state_id, country_id
cities: name, city_id, state_id
etc etc etc (depending on how long your hierarchy is)
Then the three corresponding widgets on the design surface would have these properties:
Country Widget:
External Source = countries
Display Field = name
Value Field = country_id
State Widget:
External Source = states
Display Field = name
Value Field = state_id
Filter Field = country_id
City Widget:
External Source = cities
Display Field = name
Value Field = city_id
Filter Field = state_id
etc etc etc (depending on how long your hierarchy is)
Resources
XForms was discussed on a May 9th University call. Watch xforms video