- This topic has 5 replies, 2 voices, and was last updated 7 years, 4 months ago by
Simon.
Viewing 5 reply threads
-
AuthorPosts
-
-
August 31, 2014 at 9:57 pm #2357
SimonMemberI cannot seem to get two file fields to work correctly inside an “add_more”. When selecting images for the 2nd field in the 2nd or subsequent item, the images are all added to the first item when saved.
piklist('field', [ 'type' => 'group', 'add_more' => true, 'template' => 'field', 'fields' => [ ['type' => 'file', 'field' => 'flavour-images', 'label' => 'Image(s)'], ['type' => 'file', 'field' => 'flavour-nutrition-info', 'label' => 'Nutritional info'], ] ]);The same issue occurs when using
'basic' => true. Is this a bug? Or am I doing something wrong? -
September 9, 2014 at 11:44 am #2411
SteveKeymaster@simon– All fields in the
fieldsparameter need to be in an array. This will work:piklist('field', array( 'type' => 'group', 'template' => 'field', 'add_more'=> true, 'fields' => array( array( 'type' => 'file', 'field' => 'flavour-images', 'label' => 'Image(s)', ), array( 'type' => 'file', 'field' => 'flavour-nutrition-info', 'label' => 'Nutritional info', ) ) )); -
September 11, 2014 at 5:07 am #2427
SimonMemberSteve, your array and my array are exactly the same (except that I used the short array syntax available in PHP 5.4+).
Have you tried that code and got it to save successfully for 2 or more items?
-
September 11, 2014 at 11:38 am #2428
-
September 29, 2014 at 2:02 pm #2495
SteveKeymaster@simon– You will need to specify the number of columns when using this template and a group field.
piklist('field', array( 'type' => 'group', 'template' => 'field', 'add_more'=> true, 'fields' => array( array( 'type' => 'file', 'field' => 'flavour-images', 'label' => 'Image(s)', 'columns' => 12 ), array( 'type' => 'file', 'field' => 'flavour-nutrition-info', 'label' => 'Nutritional info', 'columns' => 12 ) ) )); -
September 29, 2014 at 7:11 pm #2496
SimonMemberI assume this only fixes the layout, but not the saving issue?
-
-
AuthorPosts
Viewing 5 reply threads
- You must be logged in to reply to this topic.