Default value for field in clonable group

Support MB Group Default value for field in clonable groupResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #38288
    HazmiHazmi
    Participant

    Hi,

    I want current date in custom field in clonable group.

    array(
    'name' => __('INSERT',TEXTDOMAIN),
    'id' => $prefix . 'product_insert',
    'type' => 'date',
    'size' => 20,
    'readonly' => true,
    'std' => current_datetime()->format('Y-m-d-H-i')
    ),

    Current date is only for the first group in clonable field when i create new post. If I add (click) to another group of fields, then this field is empty.

    With this

    'clone_default' => true,

    it works fine - but i don't want another set of fields to have default values (even if i set std to have empty values within this fields).

    So, how can i do this?

    #38299
    Long NguyenLong Nguyen
    Moderator

    Hi Hazmi,

    You should use the setting clone_default for the subfield, not the group itself, to set the default value for a subfield in a cloneable group. Please read more on this documentation https://docs.metabox.io/extensions/meta-box-group/#clone-default-values

    #38302
    HazmiHazmi
    Participant

    Hi,

    thank you - it helped me.

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