Any pointers would be welcomed.
As someone that uses ACF a lot I completely understand your frustration. The problem is that there does not seem to be a lot of people that want to move outside of the box that 98% of ACF users need. This means that there aren’t many examples available to do specific things.
It can literally take me hours to work out the details of what needs to be done and that is if when I completely understand what needs to be done.
If you give me more details and I can find some time I will look at creating an example.
How is the data generated? What format is this data in? How to you get it? Details about the repeater and sub fields? What data needs to go in each field?
I’ve worked for 40+ yeas in IT development. support and consulting, and I understand it’s difficult, but we never released a toolset then didn’t give our customers documentation or support for it.
Anyway, enough a a rant. I have a field group as follows;
Picture – image
Location – text
Date – datepicker
People – Repeater
–Person – relationship
–coord_left – number
–coordtop – number
–coordright – number
–coordbottom – number
I load the image and run a js using Clarifai’s face recognition engine. It returns boxes around each face in the picture and a list of coords of these boxes.
I want to populate the repeater field with the ID of a unknown person (from the people field group) and he coords from above. The user will then change the person from the unknown person to one from the field group and save the post.
I have the recognition working and the trigger click firing the code from the acf.addaction append code you pointed me at. I’m trying now to add the ID and coord fields with the data from the face recognition.
I was hoping I could have something to loop through the faces I have, triggering the new row, then adding the 5 fields. Although this should work, it’s a bit messy.
I would have hoped there was a add.row function that I could call to add my rows before displaying them, rather than acting like keyboard input and relying on the users to save the updates.
I find it very difficult to identify the field names as on the page they seem to be part of a hierarchy which I cannot find a description for (e.g. id=”acf-field_609af70f9fdac-acfcloneindex-field_609af86f9fdb1″ name=”acf[field_609af70f9fdac][acfcloneindex][field_609af86f9fdb1] where the field ending in db1 corresponds to one of the coordinate fields I defined). This makes the coding more difficult.
I hope I’ve not gone on too much, but thanks for your help anyway.
I was looking at this and was coming back to tell you that I didn’t have a lot of luck, but it looks like someone helped you in another thread. The .add() method for repeaters is not documented and I did not find it when looking at the ACF code. I myself will be saving a link to that thread so I can find it in the future.
John, Christian came up with a possibility which I haven’t had chance to test yet, but it looks like it might be a good solution.
Thanks again for your help
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
Last but not least, we built a 100% PHP based Gutenberg Block API designed specifically for theme developers in the real world creating bespoke and maintainable blocks for future driven projects!https://t.co/bx8HrCwkjF— Advanced Custom Fields (@wp_acf) May 31, 2021
❤️ 10 of 10 pic.twitter.com/OacUqWGrZZ
© 2021 Advanced Custom Fields. Subscribe