Unique ID for nested group items?

Support MB Group Unique ID for nested group items?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #7929
    hannuhhannuh
    Participant

    Hi!

    I have multilevel nested groups:

    Question (clone true)
    -Answers (clone true)

    I would like to add a hidden field which would be a unique id of each answer.

    If I add 'std' => uniqid() for the hidden field all the answers will have same unigid value. Is there possibility to use 'type' => 'hidden' field and add a callback function which would echo a std value e.g. with uniqid() when new answer is added from the add button on admin side? On the admin side this unique id is not needed thus hidden field, but on the front end side code I would need this unique id to identify the answer to update statistics of answers.

    Or is there some other way to get the unique id of meta values (similar to unique post id's)? As if I rely to answer/question counter then the statistics are messed when questions/answers are deleted.

    Thanks!

    #7934
    Anh TranAnh Tran
    Keymaster

    Hi,

    The std is used to the field value. I think it's not the right element to use to create the statistics. Can you try using the hidden fields' IDs? They're dynamically changed when a new clone is created and unique.

    #7937
    hannuhhannuh
    Participant

    Sorry I think you understood incorrectly. I'm not using metafields to store statistics. But I need unique id of each clone answer so that I can store the statistics of each answer to database table.

    How do I get the hidden fields ID, can you give example? Thanks!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.