In some cases, it is possible that you want to list down all the options from any SDF. Mostly use in custom field setup in channel form. You can fetch all the options by passing ID or Field short name in {exp:super_dynamic_fields:parse}
Prefix of sub field that you can fetch all options of. Default prefix is item.
prefix=“sd”
Field ID of SDF channel field you want all options to list out.
field_id=“10”
Field short name of SDF channel field you want all options to list out.
field_name=“my_field_short_name"
Variables you can use: (assuming item as a prefix.)
This variable will return Option Label.
{item:label}
This variable will return Option Value.
{item:value}
This variable will return TRUE if given option is marked as default or FALSE if given option is not marked as default.
{item:default}
As we mentioned in many places, label and value is required variable in JSON but you can pass any other variables in JSON too. All those variables can be fetch at frontend. Suppose JSON has another variable named entry_id, Code will be:
{item:custom_field}
{item:entry_id}
This variable will return current count of loop.
{item:count}
This variable will return total number of rows in loop.
{item:total_results}
<select name="super_dynamic">
{exp:super_dynamic_fields:parse field_name="super_dynamic" prefix="item"}
<option value="{item:value}">{item:label}</option>
{/exp:super_dynamic_fields:parse}
</select>
<select name="super_dynamic">
{exp:super_dynamic_fields:parse field_name="super_dynamic" prefix="item"}
<option value="{item:value}"
{if super_dynamic != ""}
// If there is already value in field. Case: [Edit form, Submit form inline with post data.]
{if super_dynamic == item:value}selected{/if}
{if:elseif item:default}
// If marked pre selected
selected
{/if}
>
{item:label}
</option>
{/exp:super_dynamic_fields:parse}
</select>
{error:super_dynamic}