Under Setup Section
- Drag a 'DB Read' action onto the on load area - before the 'HTML (render form)' action. You can leave the 'on found' and 'on not found' areas empty, but I put an 'event loop' into the 'on not found' area. If there's any chance that the field will be blank, do not put a 'event loop' action in there. I suggest not doing that in general after all the troubleshooting I did before realizing that the field could be blank - in which case send the form into a loop.
- Click 'edit' on that action.
- Select the table you want to retrieve data from. I'll use 'users' as an example.
- Multi-read will usually be yes unless you want less than one field returned.
- Enable model ID MUST be yes. The directions I read before said it was optional, but that's not true.
- Create a unique model id and enter it into that field. I'll use 'names' for the model ID as an example.
- Enter the field or fields. I'll use 2 for an example (id,name).
- You can ignore the rest of the fields, but you may want to use the conditional. Here's an example from my form where I only wanted to show registered users ('registered' id in the system is 2)...
<?php return array('user_group' => '2'); ?>
Under Designer Section
- Drag a new form field onto the form. I'm using a dropdown for my example.
- In the 'general' tab, name your form. I used the same name as the model (names). This might be required (to be identical to the model).
- I removed the default 'yes=1, no=2' that is in the 'options' box.
Dynamic Data Tab
- Under the 'dynamic data' tab, set 'enabled' to 'yes'.
- Data path will be the model ID. This is what was missing on the instructions from the developers. So I set it to 'names'.
- The 'value key' and 'text key' are basically the options like you would set on the previous tab if you weren't using dynamic data to populate your field. So, I used 'id' for the value key and 'name' for the text key. This will show the user the names and save it under the IDs. You could also use 'name' for both and it would show the user the names and also save the name they select.