When saving a preset in the UI, we have observed the attached text being printed to the screen, there is no other output, just this. I'm assuming it's the result of an AHAH operation but a simple grep for unintentionally included 'echo' or 'print' debug statements doesn't find anything. Unfortunately I haven't had time to do any further digging.

We've tested in Firefox 3.5.9 and are not doing anything particularly unusual, just adding a layer, then saving a preset.

CommentFileSizeAuthor
openlayers_output.txt5.82 KBjohngriffin

Comments

tmcw’s picture

Bizarre. I think I've seen this once or twice. Can you try running with Firebug or an equivalent open to see if there are any Javascript errors popping up?

buddhamagnet’s picture

I am having this issue also. Chrome console shows:

Resource interpreted as document but transferred with MIME type text/javascript.

I am dynamically rebuilding a select box using AHAH but this is only done on change. When the form submits (which does not call that function) I get the JSON splat.

buddhamagnet’s picture

The form elements are:

$form['select_platform'] = array(
'#type' => 'select',
'#title' => t('Select platform'),
'#options' => array('N/A' => 'N/A', 'PSP' => 'PSP', 'ps2' => 'Playstation 2', 'ps3' => 'Playstation 3', 'ds' => 'NintendoDS', 'gamecube'=> 'Gamecube', 'wii' => 'Wii', 'xbox' => 'Xbox', '360' => 'Xbox360', 'mac' => 'Mac', 'advance' => 'Gameboy Advance', 'pc' => 'PC'),
'#ahah' => array(
'event' => 'change',
'path' => 'ajax/get_prizes_ahah',
'wrapper' => 'ahah-wrapper',
'method' => 'replace',
),
);

$form['prizes2'] = array(
'#type' => 'select',
'#title' => t('Select from a choice of games'),
'#options' => sr_incentives_get_prizes('game'),
'#prefix' => '

',
'#suffix' => '

',
);

...and the AHAH method is:

function sr_incentives_ajax_get_prizes_ahah() {

$form_state = array('storage' => NULL, 'submitted' => FALSE);
$form_build_id = $_POST['form_build_id'];
$platform = $_POST['select_platform'];
watchdog('sr_incentives', "PLATFORMAGE: $platform", array(), WATCHDOG_DEBUG);
$form = form_get_cache($form_build_id, $form_state);

$args = $form['#parameters'];
$form_id = array_shift($args);
$form_state['post'] = $form['#post'] = $_POST;
$form['#programmed'] = $form['#redirect'] = FALSE;

$query_prizes = db_query("SELECT disp, name FROM {sr_incentives_prizes} WHERE category = 'game' AND count > 0 AND platform = '%s' ORDER BY disp ASC", array($platform));
$prizes = array();
while ($row = db_fetch_array($query_prizes)) {
$prizes[$row['name']] = $row[disp];
}

$ahah_form = $form['prizes2'];
$ahah_form['#options'] = $prizes;

form_set_cache($form_build_id, $form, $form_state);

drupal_process_form($form_id, $form, $form_state);

$form = drupal_rebuild_form($form_id, $form_state, $args, $form_build_id);

unset($ahah_form['#prefix'], $ahah_form['#suffix']);

$output = drupal_render($ahah_form);

drupal_to_js(array('status' => TRUE, 'data' => $output));
}

tmcw’s picture

buddhamagnet: can you test taking out the custom code and seeing whether the issue persists?

tmcw’s picture

Status: Active » Postponed (maintainer needs more info)

Any luck trying this without the custom code? If the form is not getting rebound by jQuery after something is done to it, this will be the result.

tmcw’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

Closing, please reopen if the issue is persisting or you can give more information.