Hi Prodigy community,
does anyone know, whether it's possible to have multiple text_input fields and load different placeholders by the stream (using the JSON loader)?
Thanks in advance!
Hi! In general, you can set up multiple text inputs via the blocks UI and give them different IDs (the field the value is saved to) and placeholders:
blocks = [
{"view_id": "text_input", "field_id": "field_a", "field_placeholder": "Placeholder A"},
{"view_id": "text_input", "field_id": "field_b", "field_placeholder": "Placeholder B"},
# etc.
]
However, this does require the IDs and placeholders to be defined once at the recipe level. The field_id
and field_placeholder
here basically overwrite whatever is in the underlying JSON data.
If you want your blocks to have different placeholders depending on the task, that's a little more involved. In theory, the "blocks"
config you return from a recipe is just a config setting that can also be overwritten by an individual task. So this should work:
{"text": "...", "config": {"blocks": [...}}
So each task could specify its own blocks with input fields and their own placeholders. You probably want to add these to your stream in Python in your custom recipe.