Tagged: add_more CPT metabox
- This topic has 1 reply, 2 voices, and was last updated 3 years, 11 months ago by
Steve.
Viewing 1 reply thread
-
AuthorPosts
-
-
February 25, 2018 at 11:27 am #8754
mikakooParticipantHi all,
Is there a piklist way to prevent the add_more remove button being used based on a field in that add_more group?What I have is an Event CPT which uses add_more repeater fields to add any number of lunch options.
As attendees book, they choose their lunch and the count of that meal increases.
Obviously, we don’t want to be able to delete a lunch option that has been selected (count > 0 ) so disabling the remove button on the repeater here seems the most sensible, direct choice.Yes, I could wizz up a bit of javascript to disable it, but thought I’d ask the question as it may be a feature you could consider adding if not already there…
piklist('field', array( 'type' => 'group', 'field' => 'event_menu', 'label' => 'Menu', 'columns' => 12, 'scope' => 'post_meta', 'template' => 'field', 'add_more' => true, 'sortable' => false, // sorting changes the meta_id, which we use as selection for attendee booking - so we don't want that changing! 'fields' => array( // TITLE array( 'type' => 'text', 'field' => 'menu_title', 'label' => 'Title', 'columns' => 3 ), // DESCRIPTION array( 'type' => 'text', 'field' => 'menu_description', 'label' => 'Description', 'columns' => 8 ), // COUNT array( 'type' => 'number', 'field' => 'menu_count', 'label' => 'Count', 'columns' => 1, 'value' => 0, 'attributes' => array( 'step' => '1', 'min' => '0', 'max' => '9999', ) ), ) )); -
February 27, 2018 at 11:10 am #8759
SteveKeymasterThere currently is no Piklist way of doing this.
-
-
AuthorPosts
Viewing 1 reply thread
- You must be logged in to reply to this topic.