Viewing 2 reply threads
  • Author
    Posts
    • #2185
      Jason
      Keymaster

      I was wondering if it’s possible to display a field based on the fact of whether or not a file field has any images selected or not. Unfortunately it didn’t work, but I tried this:

      piklist('field', array(
        'type'    => 'group',
        'field'   => 'features',
        'label'   => 'Features',
        'add_more'=> true,
        'fields'  => array(
          array(
            'type'    => 'text',
            'field'   => 'title',
            'label'   => 'Title',
            'columns' => 12
          ),
          array(
            'type'    => 'textarea',
            'field'   => 'description',
            'label'   => 'Description',
            'columns' => 12,
            'attributes'  => array(
              'rows'        => 4
            )
          ),
          array(
            'type'    => 'file',
            'field'   => 'image',
            'label'   => 'Featured Image',
            'columns' => 12
          ),
          array(
            'type'    => 'radio',
            'field'   => 'image-alignment',
            'label'   => 'Image Alignment',
            'columns' => 12,
            'value'   => 'bottom',
            'list'    => false,
            'choices' => array(
              'align-top'     => 'Top',
              ''              => 'Center',
              'align-bottom'  => 'Bottom'
            ),
            'conditions'  => array(
              array(
                'field'   => 'features:image',
                'compare' => '!=',
                'value'   => ''
              )
            )
          )
        )
      ));
    • #2186
      Jason
      Keymaster

      As a side note, in the documentation in both places you show the compare element, you’re using != as a literal instead of a string. This would cause an error. It should be ‘compare’ => ‘!=’.

    • #2202
      Steve
      Keymaster

      @jason– Docs have been updated.

Viewing 2 reply threads
  • You must be logged in to reply to this topic.