Group field not showing in metabox

Support MB Group Group field not showing in metabox

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #3116
    BiznetBiznet
    Participant

    Hi,
    I'm new to the premium plugins, and I tried that night to implement a group field using the doc, but it looks like it won't appear in admin.
    Below is my code. The other fields of the metabox are showing, and after a few tests, it looks like the group field class is loaded, but the html method is never triggered.

    meta_boxes[] = array(
    		'id'         => 'infos_supp_adherent',
    		'title'      => "Informations sur l'Adhérent",
    		'post_types' => array( 'adherent' ),
    		'fields' => array(
    			array(
    				'name' => "Nom",
    				'id' => $prefix . "adherent_nom",
    				"type" => "text", 
    				"required" => true,
    				"clone" => false
    				),
    			array(
    				'name' => "Prénom",
    				'id' => $prefix . "adherent_prenom",
    				"type" => "text", 
    				"required" => true,
    				"clone" => false
    				),
    			array(
    				'name' => "Date de Naissance",
    				'id' => $prefix . "adherent_naissance",
    				"type" => "date", 
    				"required" => true,
    				"clone" => false,
    				"dateFormat" => "dd/mm/yy"
    				),
    			),
    			array(
    				'name' => "Coordonnées",
    				'id' => $prefix . "adherent_coordonnees",
    				'type' => 'group',
    				//'required' => true,
    				'clone' => true,
    				'fields' => array(
    					
    					array(
    						'name' => 'Information',
    						'id' => $prefix . "adherent_coordonnees_valeur",
    						'type' => 'text',
    						'required' => true,
    						'clonable' => false,
    					)
    				)
    			)
    		);
    #3125
    Anh TranAnh Tran
    Keymaster

    Oh, there is a syntax error in your code. Here is the correct one:

    $meta_boxes[] = array(
    		'id'     => 'infos_supp_adherent',
    		'title'  => "Informations sur l'Adhérent",
    		'post_types' => array( 'adherent' ),
    		'fields' => array(
    			array(
    				'name'     => "Nom",
    				'id'       => $prefix . "adherent_nom",
    				"type"     => "text",
    				"required" => true,
    				"clone"    => false,
    			),
    			array(
    				'name'     => "Prénom",
    				'id'       => $prefix . "adherent_prenom",
    				"type"     => "text",
    				"required" => true,
    				"clone"    => false,
    			),
    			array(
    				'name'       => "Date de Naissance",
    				'id'         => $prefix . "adherent_naissance",
    				"type"       => "date",
    				"required"   => true,
    				"clone"      => false,
    				"dateFormat" => "dd/mm/yy",
    			), // Error was here when you close the outter bracket
    			array(
    				'name'   => "Coordonnées",
    				'id'     => $prefix . "adherent_coordonnees",
    				'type'   => 'group',
    				//'required' => true,
    				'clone'  => true,
    				'fields' => array(
    
    					array(
    						'name'     => 'Information',
    						'id'       => $prefix . "adherent_coordonnees_valeur",
    						'type'     => 'text',
    						'required' => true,
    						'clonable' => false,
    					),
    				),
    			),
    		),
    	);
    #3128
    BiznetBiznet
    Participant

    Hi,
    indeed, it now does work fine.
    Thanks !

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Group field not showing in metabox’ is closed to new replies.