Custom Fields
Support Meta Box Group Unique ID for nested group items?

  • Creator
  • #7929


    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.


Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
  • #7934
    Anh Tran


    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.


    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 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.