Dear all,
I am dynamically generating a form and the number of fields is not always the same, therefore, I have to generate dynamic names for the input fields.
For this, i am defining a field count and setting it to 0,
- Code: Select all
<cms:set field_count='0' />
I am setting the name of the input field, followed by the field count number to make unique names,
- Code: Select all
<cms:set s_field="<cms:concat 'field_' field_count />" scope='global' />
I am creating the field with that name,
- Code: Select all
<cms:input name=s_field type='text' />
And at the end of every loop, I am incrementing the field count by 1.
- Code: Select all
<cms:incr field_count '1' />
Everything is working as expected but the main issue that i have is when I need to pull the value of that input field:
- Code: Select all
<cms:capture into='my_data.' is_json='1'>
{
"field" : <cms:escape_json><cms:show frm_s_field /></cms:escape_json>
}
</cms:capture >
I know that under normal circumstances it should be frm_s_field if the name would be hardcoded but in this current situation, this will not work since s_field is not the name, it holds the field name.