I have a form with a gmap and a gmap_address field.
The following code do not work.
If i put the map before the gmap_address field (changing '#weight' => '4.1', per 2.1) it works again.
If I put both fields outside the fieldset (gmap_address before gmap) it works also.
Any Idea

$form['coordonnes'] = array(
  '#type' => 'fieldset',
  '#title' => 'Coordonnées',
  '#collapsible' => '0',
  '#collapsed' => '1',
  '#group' => 'coordonnes',
  '#weight' => '0',
  '#theme' => 'form_panel_table',
  '#form_panel_weights_decimal' => TRUE,
);

  // adding fields for searching address
$form['coordonnes']['address'] = array(
    '#type' => 'gmap_address',
    '#map' => 'selector_map',
    '#title' => t('Rechercher '),
    '#description' => 'Saisir une adresse ou un lieu-dit',
    '#default_value' => '',
    '#weight' => '3.1',
  );
$form['coordonnes']['search'] = array(
    '#type' => 'button',
    '#button_type' => 'button',
    '#executes_submit_callback' => FALSE,
    '#value' => t('Rechercher'),
    '#weight' => '3.2',
  );

$form['coordonnes']['markup'] = array(
  '#weight' => '1',
  '#type' => 'markup',
  '#weight' => '4.1',
  '#form_panel_table_attributes' => array('colspan' => 2),
  '#suffix' => '<div class="description">Deplacer la carte et zoomer pour d&eacute;finir l\'emplacement de la station</div>',
);

$settings = array();
$form['coordonnes']['markup']['mapdiv'] = array(
    '#type' => 'gmap',
    '#map' => 'selector_map',
    '#settings' => array_merge(array(
      'latitude' => is_null($node->latitude)?43.46886761482925:$node->latitude,
      'longitude' => is_null($node->longitude)?3.438720703125:$node->longitude,
//	  'latitude' => 43.46886761482925,
//      'longitude' => 3.438720703125,
      'width' => '100%',
      'height' => '343px',
      'align' => 'right',
      'zoom' => 9,
      'maptype' => 'Hybrid',
      'mtc' => 'none',
      'points' => array(),
      //'markers' => array(),
      'pointsOverlays' => array(),
      'behavior' => array(
          'centercross' => TRUE,
      ),
    '#theme' => 'gmap_macro',
    ), $settings),
  );

Comments

johnv’s picture

Status: Active » Closed (won't fix)

Closing this very old issue. Please reopen if it is still valid.