Skip to main content


 

This is a brief guide on how to correctly use a drop-down control in an Editable List View column in SmartForms.  For the sake of this tutorial, I am going to create a basic SmartBox SmartObject to hold our list column data, but you can use any pre-existing SmartObject for this.  If you have your own List View ready to go, you can skip to the ‘Configuration’ section below.

 


Set Up
- Open K2 Designer
- Right-click on an existing Category and select ‘New Category’.
- Right-click on your Category and select ‘New SmartObject’.
- In the SmartObject wizard, add a ‘Year’ field with ‘Number’ type.  (This is where we will store the output of the drop-down)

 


 16443i0BCD304EA88F27BE.png

 


- Save the SmartObject.
- Right click on the SmartObject and select ‘Generate Views’.

 


 14387i20EBEBEF1D43B96E.png

 


- Select ‘Editable List’ and click ‘Okay’

 

 

 

16608i882EFC26F7EAD570.png‘Change Control’ button.
- Select ‘Drop-Down List’ and click ‘OK’.

 

 

 

12031i4CC95C635C08ACCB.png
 
- In the properties box in the bottom right corner, scroll down to the ‘Data Source’ section and click the ellipses next to ‘Type’.
- Select ‘Use a static list of values in the control’ and configure.

 


Note: You can alternatively use a SmartObject as a data source for your drop-down, just make sure your ‘Value’ and ‘Display’ fields are set to the field that you wish to see within the drop-down.

 


- Add some items (with identical ‘Value’ and ‘Display’ data) and confirm your changes.

 


 16489i236B7D33DF504454.png

 


- In the properties box in the bottom right corner, under the ‘Settings’ section, uncheck the ‘Allow Empty Selection’ box.
- Click ‘Rules’ at the top and edit the ‘When the View executed List item changed’ rule.

 

 

 

Note: This rule is triggered after editing a list view row and either pressing Enter or clicking outside of the rule.

 


16127iEF9868AEB1074D39.png

 


- Add a ‘Transfer data’ Action above the pre-existing rule, then click ‘configure’.
- Expand the green SmartObject reference at the bottom left, then expand the ListName -> Controls -> Add/Edit Row hierarchy in the Context Browser on the right.
- Drag the ‘Year Drop-Down List’ into the ‘Year’ field of the SmartObject reference and confirm your changes.

 

 

 

15004iAB4705ADFD15B9C5.png
 
Note: Without adding the ‘Transfer Data’ step, the view won’t know to use the default value of the drop-down (when no values have been manually selected) and the column will remain blank after editing.  In the context of this rule, the SmartObject reference fields (as seen above) refer to the specific List View row that was edited.  Putting data in these fields is not the same as saving data to the SmartObject.  This will only add data to the temporary reference that is used to display unsaved changes on the List View (as if someone typed something into the field but did not click save).

 


- Save the View.
- You can quickly test your view by right-clicking on it in the Category window on the left and selecting ‘Run’.

 

 



 

Hi.. I did follow each step to create drop down list. But after I add new row (without click save button), the field went blank. Kindly assist. Thanks


Reply