Tagged: ,

Viewing 2 reply threads
  • Author
    Posts
    • #7380

      Hello, i’m having hard times with this, i have 2 groups, this is my code…

      <?php
      /*
      Title: Parroquias en las que se imparte este curso
      Post Type: cursos
      Priority : high
      Order : 1
      Locked : true
      New : true
      Collapse : false
      Meta box : true
      */
      
      piklist('field', array(
          'type' => 'group'
          ,'field' => 'curso_parroquias'
          ,'label' => 'Parroquias que imparten el curso'
          ,'value' => 'none'
          ,'add_more' => true
          ,'fields' => array(
            array(
              'type' => 'select'
              ,'field' => 'parroquia'
              ,'label' => 'Parroquia'
              ,'columns' => 12
              ,'choices' => array('none' => 'Elija una parroquia') + piklist(
                get_posts(
                   array(
                    'post_type' => 'parroquias'
                    ,'posts_per_page' => -1
                    ,'orderby' => 'title'
                   )
                   ,'objects'
                 )
                 ,array(
                   'ID'
                   ,'post_title'
                 )
              )
              ,'required' => false
            )
            ,array(
              'type' => 'group'
              ,'field' => 'info_curso'
              ,'columns' => 12
              ,'add_more' => true
              ,'fields' => array(
              	array(
              		'type' => 'date'
              		,'field' => 'curso_date'
              		,'label' => 'Fecha'
             			,'columns' => 12
             			,'required' => false
              	),
              	array(
              		'type' => 'text'
              		,'field' => 'curso_hour'
              		,'label' => 'Hora'
             			,'columns' => 12
             			,'required' => false
              	)
              )
            )
          
          )
        ));
      
      piklist('field', array(
          'type' => 'file'
          ,'field' => 'curso_material'
          ,'label' => __('Material del curso') 
          ,'columns' => 12
        ));

      how can i display this, in selects? im trying to use piklist template, but with no lucky…

      i want to click in one select and then show date (curso_date) and hour (curso_hour) related to my church (parroquia), like dependent combos

      | select a church | ==> | date and hour of my course |

      is this possible?

      thanks!

    • #7381

      When i print the “curso_parroquias” field, i get this

      Array ( [parroquia] => 17724 [info_curso] => Array ( [curso_date] => Array ( [0] => 2013-10-03 [1] => 2013-10-03 [2] => 2013-10-03 ) [curso_hour] => Array ( [0] => 02:04 [1] => 02:04 [2] => 02:04 ) ) ) Array ( [parroquia] => 17732 [info_curso] => Array ( [curso_date] => Array ( [0] => 2016-09-03 ) [curso_hour] => Array ( [0] => 03:57 ) ) )

      how can i know what array display? i mean, in my code above i selected a group field that contains a date and hour and one church can have one or more dates and hours, i explain myself? and this array is not orderer correctly to display the data like this

      Church 17724
      ————
      Courses =>
      ———— 2013-10-03 at 02:04
      ———— 2013-10-03 at 02:04
      ———— 2013-10-03 at 02:04

      Church 17732
      ————
      Courses =>
      ———— 2016-09-03 at 03:57

      could you please help me?

      thanks a lot 🙂

    • #7382
      tirins007
      Participant

      If I understood your requirements correctly, you want to be able to add multiple churches and under each of them add multiple courses. In this case shouldn’t your repeatable ‘info_curso’ group be placed in fields array of ‘curso_parroquias’ group? My apologies if I got your idea wrong.

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