Viewing 5 reply threads
  • Author
    Posts
    • #2631
      mrioa
      Member

      Note sure if my problem is related to the ones described here. Are the ones mentioned in this thread already supposed to be fixed?

      I’m having a radio-field outside of a group. Based on that value I have conditional add_more groups with simple text-fields inside. But when I add a new group, it is hidden even though the radio choice is set to the needed value. When I switch the radio to another value and back to my desired one, the new group is shown properly. (see the gif)

      /*
       * Choice of item type
       * default value = drink
       */
      
      piklist('field', array(
          'type' => 'radio'
          , 'field' => 'type'
          , 'label' => 'Typ'
          , 'choices' => array(
              'drink' => 'drink'
              , 'other' => 'other'
          )
          , 'value' => 'drink'
      ));
      
      /*
       * Group buy drinks
       * add more 
       * condition if type = drink
       * 2 text fields "buy_size" and "buy_price"
       */
      
      piklist('field', array(
          'type' => 'group'
          , 'field' => 'buy'
          , 'label' => 'Einkauf'
          , 'add_more' => true
          , 'conditions' => array(
              array(
                  'field' => 'type'
                  , 'value' => 'drink'
              )
          )
          , 'fields' => array(
              array(
                  'type' => 'text'
                  , 'field' => 'buy_size'
                  , 'label' => 'size')
              , array(
                  'type' => 'text'
                  , 'field' => 'buy_price'
                  , 'label' => 'price'
              )
          )
      ));

      If there is a way to set the initial visibility of an added conditional group based on it’s precedessor, that would be great 🙂

      Visibility of added groups based on a condition

      Attachments:
      You must be logged in to view attached files.
    • #2633
      Steve
      Keymaster

      @mrioa– I split this into another topic since it had nothing in common with the other ticket.

      Piklist comes with a grid system for fields. You need to use it when creating GROUP fields. Try adding the columns parameter:

      piklist('field', array(
          'type' => 'group'
          , 'field' => 'buy'
          , 'label' => 'Einkauf'
          , 'add_more' => true
          , 'fields' => array(
              array(
                  'type' => 'text'
                  , 'field' => 'buy_size'
                  , 'label' => 'size'
                  , 'columns' => 12
              )
              , array(
                  'type' => 'text'
                  , 'field' => 'buy_price'
                  , 'label' => 'price'
                  , 'columns' => 12
              )
          )
      ));
      
    • #3121
      mrioa
      Member

      @Steve- I’m so sorry, I didn’t realize the topic splitting and thought my post in the other topic got lost (I wasn’t using my own device to post it that day).

      Glad I found your info today, it’s working now!

      Thanks to adding the column-setting I was able to update to the latest version of piklist without a problem.
      But now I’m missing the description of fields inside a group. I assume this is due to the point “ENHANCED: Updates to group fields” in 0.9.4.23.
      Did it just got removed or is there a new way of using it?

      Thank you so much for the great tool and excellent support!

      Cheers,
      Mario

    • #3124
      Steve
      Keymaster

      @mrioa– Where do you want descriptions? I don’t see it in your code.

    • #3125
      mrioa
      Member

      Right, I added it afterwards:

      Example:

      piklist('field', array(
          'type' => 'group'
          , 'label' => 'Einkauf'
          , 'add_more' => true
          , 'fields' => array(
              array(
                  'type' => 'text'
                  , 'field' => 'buy_size'
                  , 'label' => 'size'
                  , 'description => 'Additional info'
                  , 'columns' => 12
              )
              , array(
                  'type' => 'text'
                  , 'field' => 'buy_price'
                  , 'label' => 'price'
                  , 'description => 'Additional info'
                  , 'columns' => 12
              )
          )
      ));
    • #3126
      Steve
      Keymaster

      @mrioa– I don’t believe Piklist ever allowed descriptions in Grouped fields. You can use ‘help’ instead:

      , 'help => 'Additional info'

Viewing 5 reply threads
  • The topic ‘Group field add-mores’ is closed to new replies.