XForms Newbies FAQs

Purpose

There are a lot of documentations for using xforms module. For xforms newbies, they might not know the right lingo how to ask and what keywords to use to search. This page contains common questions for xforms newbies which might help them to get started.

Binding is disabled, how to make it enabled?

Set xforms.allowBindEdit to “true” in global properties. Please see XFRM-79 for more info.

How to show concept id of form field in xforms?

Set xforms.useConceptIdAsHint to “true” under global properties. When you mouse over the form field question, it will display the concept description its concept id.  However, it doesn’t show concept id for the form fields’ answers when the concept question is coded datatype. Please see XFRM-102 for more info.

How to change the dropdown box of Encounter Location to lookup widget?

Delete the dropdown box for Encounter ID and add a text box on Design Surface. Click on the text box and go to properties to bind it to Encounter ID. Click on the Encounter ID form field, go to its widget properties. Put “location” on the External Source.

How to add more pages?

Right click on any empty space (not on any widget) on Design Surface. If you right click on empty space in Group Box Widget, you won’t see the “New Tab” option.

How to change numeric datatype to be displayed as coded answers on Design Surface?

First to change the widget type to “Single Select”. Then add child options with displayed text and binding to different values. Delete the old field from the Design Surface. Drag and drop from the single select field.

How to show obs date?

Add a new field and change the datatype to date, update the node name of binding to “obs/fieldname/date”. If binding field is disabled, you will need to set xforms.allowBindEdit to true first. Remember to turn it back to false after you are done to prevent any changes of binding accidentally. Please see XFRM-79 for more info.

How to move a group of elements on the Design Surface?

You can use the rubber band by pressing left click on Design Surface. Remember that all elements must be totally inside the rubber band in order to be selected.

How to make the elements on Design Surface looking nice and neat?

You can first use rubber band to select the elements you want them to be aligned. Then, select one of the Align Left, Align Right, Align Top, or Align Bottom function to make them looking nice and neat.

If I want to have xforms working in remote sites, what do I need to do?

Set “true” for xforms.isRemoteFormEntry in global properties.

How to align the text header in group box widget?

Select the group box widget, then go to the widget properties panel and change the Text Align property.

How to add columns and rows to tables?

Before adding a column or row, you need to first click on the table or row from which you are going to add a new column or row.  Then right click, go to "table", and then select "add columns" or "add rows".

How to edit the size of rows and columns of tables?

If you want to resize a column or row without moving the widgets within or without the columns and rows (which is the default), you can re-size the lines with the mouse while pressing CTRL on the keyboard. 

How to move widgets with the keyboard instead of mouse

Click on the widget to select it, and then use the Left, Right, Up, Down keys on your keyboard.

How to resize a widget with the keyboard instead of mouse

Click on the widget to select it, the press to hold down the SHIFT key, and then use the Left, Right, Up, Down keys on your keyboard.

How to add, delete columns, rows to and from a table

Right click in the table and from the menu that pops up, select "Table" and choose the appropriate action from the menu items under it.

How to merge cells in a table

Drag a rubber band around the cells you want to merge. Then right click in the table and from the menu that pops up, select "Table" and choose "Merge Cells" from the menu items under it.

How to change the Time, DateTime or Date picker widget from the default to that used by OpenMRS

While on the design surface, right click on the widget and select "Change to TextBox". Then using the Widget Properties Pane set the "External Source" property to either time, datetime or date depending on the widget type you want. If after all this, the date picker widget does not show up when you click on the widget, then go back to the design surface and set the widget's ID property, to any value you want, using the Widget Properties Pane

How to add text without first having to drag and drop a label widget from the palette

Click on the design surface where you want to add text and then just directly start typing. After you are done with typing the complete text, just press ENTER, on the keyboard, to exit the edit mode.

How to edit label text without using the widget properties panel

Click on the label widget to select it, then press ENTER on the keyboard. This will let you change the text and when you are done, press ENTER again to exit the edit mode.

How to search for a form field or widget

Select "Find" from the "Edit" menu or click the find Toolbar icon. Enter the search text in the window that comes up and click OK. If you have the Properties Tab selected, this will search for a form field containing that text on the Form Fields Panel. But if you have the Design Surface selected, it will search for a widget which contains that text. When searching for form fields, the search start at the selected field and goes downwards. If you want it to start from the top, ensure that you click on the form name to select it.

How to go to the next field without using the TAB key

Just press the ENTER key as an alternative way of going to the next field in accordance to the tab index.

How to ensure that a date is between the year 2001 and today

Select the date field under the form fields panel. Then use the validation logic tab to add two validation conditions. (1) Value is greater than 2001-12-31   (2) Value is less than today()

Do not forget to add the validation error message that you want displayed to the user when they enter a date outside that range. Also notice that the format of the date you enter in the first validation condition should match that in your "xforms.dateSubmitFormat" global property.

How to fix problem where a widget is displayed on design surface but not preview

Using the properties panel, check to ensure that the field does not have any skip logic to hide it. Then using the widget properties panel, make sure that it is not sharing a tab index with another widget. A very easy way of checking this is by assigning it a randomly big tab index value like 333 or any other value that you are sure is not yet used.

How to remove the colored header from a table

Just clear the background color property for this header, using the widget properties panel. Or simply make it to have the same background color as that of the table. After doing so, the vertical lines supposed to start from the top of the table may appear as not starting from the very top. To fix this, drag re-size them to the top.

How to add a relationship widget to the form 

Refresh the form in the form designer to pull up the new relationships field. For new forms, this will come up the first time you open the form in the designer. Drag and drop this field to the design surface, if it is not already there. Using the widget properties panel, set the external source property for the relative widget to: person. That way it will show a person picker widget when you start typing. Save the form. 

How to disable multiple select answers when one of them is selected

When you load a form in the form designer, under the "Properties" tab (at its bottom), you will see a tab named "Others", which is next to the "Dynamic Lists" tab.

1) Click on a multiple select question to select in under the "Form Fields" panel.

2) Using the "Others" tab, just select the "Exclusive Option" from the drop down list you see on this tab. This is the answer which cannot be ticked together with others for the same question. And hence this is the "none" option. So just select "NONE". It can have any other name you want, other than none, which was just an example. Remember to save the form.

Resources