What is DynamicData:
Hardly the DynamicData functionaty extends the prefil of DropDown boxes in formidable. But further it also enables dynamic dependent files. So if one value in a dropdown is selected, we can query for data for another dropdown or field with the selected value.
This is a key feature to get fast access also to data – even from other tables or plugins. As we can use queries to load and select data from the whole database, we can easly process every data we need.
Think about the possiblitiys to query all tables – like woocommerce products and fill it into an formidable form. So you can use Formidable Forms to Access other Tables in the database, and – in the right usage – map it back to tables.
This is a big part in many projects. How to get data in a good way for dropdowns, also if fields has dependencies.
- Formidable Form
- Formidable Field
- Dependent Formidable Field
- Select Text (Optional)
Dependent Formidable Field:
If this is selected, the dynamic data will load after this field value es set. In the used query you can use this field value as place holder.
A query has to provide field value and field text as result. It is possible to use the value of a dependent field with placeholder: ##dependent_field_value##
Example Query: DynamicData Formidable Field with Dependent FormID
SELECT id as value , concat(name, ' (', id, ')') as text FROM wp_frm_fields WHERE form_id = ##dependent_field_value## ORDER BY text DESC
Special Case (Single Dependent Value):
If you want to prefill a field like a text or number with dynamic data, you have only to return a single value. See Following example. This behaviour is hardly used in every Wonderful Relations configuration form to get the next ascending number
Example Query: Select Max(Sort_Order)+1 for new Formlink (DynamicData)
SELECT ifnull(max(sort_order)+1,0) as value FROM wp_wr_formlink WHERE form_id = ##dependent_field_value##
With this parameter you can overwrite the default select text “– please choose –“
To use the current value of an field, you can address it with placeholder ##current_field_value##. Sometimes you what to have all elements in an dropdown which are not connected. But if you edit an form, you also what to have the selected field in this list. So you can create a query like the following
SELECT * FROM A WHERE A.id not FIND_IN_SET (A.id, ...) or A.id = '##current_field_value##'