This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Hello everyone,
after 3 days of researching for a way to accomplish my need i thought its best to ask and hope to get an answer.
In this post
https://github.com/octobercms/october/issues/2772#issuecomment-296411282
it is exactly described what i am trying to do.
I have a repeater in my backend form and the data gets saved in the database as a json like that:
"topics": [
{
"topic_title": "topic 1",
"topic_description": "topic 1 descr",
},
{
"topic_title": "topic 2",
"topic_description": "topic 2 descr",
},
],
What i would like to achieve is that the repeater items get indexed like that:
"topics": [
{
"topic_id": "1",
"topic_title": "topic 1",
"topic_description": "topic 1 descr",
},
{
"topic_id": "2",
"topic_title": "topic 2",
"topic_description": "topic 2 descr",
},
],
In another github post https://github.com/octobercms/october/issues/2451#issuecomment-259804208 it is stated that this could only be achieved by manipulating the array with
formBeforeSave()
But the information is already available in the code as
$indexCount:
input type="hidden" name="___index_topics[]" value="2"
Can you please tell me how to get index/id into a repeater field so it gets stored inside the json array?
Last updated
1-1 of 1