- This topic has 3 replies, 1 voice, and was last updated 4 years, 9 months ago by
kcarwile.
Viewing 3 reply threads
-
AuthorPosts
-
-
April 30, 2017 at 12:25 am #8035
kcarwileParticipantI’ve attached an example of a group field with add_more TRUE. I’m running the latest version of Piklist. With the example, if you add two items to the group, then save the page, and then try to remove 1 of the items, you can’t. It remains as two items but with a duplicate of the first.
-
April 30, 2017 at 12:26 am #8036
kcarwileParticipantOk, here is the file in text format.
-
April 30, 2017 at 12:26 am #8037
kcarwileParticipantMy god.
<?php /* Title: Test Post Type: page */ piklist( 'field', array( 'type' => 'group', 'field' => 'rate_options', 'label' => 'Option Prices', 'value' => isset( $rate ) ? $rate->data : array(), 'add_more' => true, 'fields' => array( array( 'type' => 'text', 'field' => 'option_name', 'label' => 'Name', 'required' => true, 'sanitize' => array( array( 'type' => 'text_field' ) ), 'attributes' => array( 'placeholder' => 'Option Name', ), ), array( 'type' => 'select', 'field' => 'option_type', 'label' => 'Price Increase', 'choices' => array( 1 => 'By Units', 2 => 'Fixed', 3 => 'Multiplier', ), ), array( 'type' => 'number', 'field' => 'option_rate', 'label' => 'Rate', 'attributes' => array( 'placeholder' => 'Rate', 'step' => '0.01', 'min' => '0', 'style' => 'max-width: 100px', ), ), array( 'type' => 'number', 'field' => 'option_unit_size', 'label' => 'Rate Units', 'conditions' => array( array( 'field' => 'rate_options:option_type', 'value' => '1', ), ), 'attributes' => array( 'style' => 'max-width: 100px', ), ), array( 'type' => 'number', 'field' => 'option_min_cost', 'label' => 'Minimum Cost', 'attributes' => array( 'step' => '0.01', 'min' => '0', 'style' => 'max-width: 100px', ), 'conditions' => array( array( 'field' => 'rate_options:option_type', 'value' => '1', ), ), ), array( 'type' => 'number', 'field' => 'option_max_height', 'label' => 'Maximum Height', 'conditions' => array( array( 'field' => 'rate_options:option_type', 'value' => '1', ), ), 'attributes' => array( 'style' => 'max-width: 100px', ), ), array( 'type' => 'number', 'field' => 'option_max_width', 'label' => 'Maximum Width', 'conditions' => array( array( 'field' => 'rate_options:option_type', 'value' => '1', ), ), 'attributes' => array( 'style' => 'max-width: 100px', ), ), ), ) ); -
April 30, 2017 at 3:27 pm #8038
kcarwileParticipantI submitted a pull request with the fix for this bug.
-
-
AuthorPosts
Viewing 3 reply threads
- You must be logged in to reply to this topic.