Hello, I am very new to Drupal. I would like to add that I am very impressed with the community. I have a Form using AHAH with a callback that performs a search of an external database table and displays the results in a div wrapper. All this works great when I click the submit button. Once the results are displayed the pagination is at bottom like expected but when I click any page number, it just displays the single line of code accross the top of browser: "{ "status": true, "data": "\x3cfieldset\x3e\x3cdiv\x3e\n \x3ctable class=..........."

The resulting line is correct, it just needs to be written to my div wrapper below my form just like when I click submit the first time.

Here is my callback:

function re_simple_search_callback() {
  $form_state = array('storage' => NULL, 'submitted' => FALSE);	 
  $form_build_id = $_POST['form_build_id'];
  $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;
  
  drupal_process_form($form_id, $form, $form_state);
  $form = drupal_rebuild_form($form_id, $form_state, $args, $form_build_id);

  $op = getListings2($form_state);

  drupal_json(array('status' => TRUE, 'data' => $op));
  exit;
}

Here is my submit button in my form:

  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => 'go',
    '#ahah' => array(
        'path' => 're_simple_search/callback',
        'wrapper' => 'search-results-wrapper',
        'method' => 'replace',
        'progress' => array('type' => 'bar', 'message' => t('Searching...')),
      ),
  );

Thank you for your time in advance.

Comments

flyonthewall’s picture

Hello,

I was really hoping someone could point me in the right direction with so many people on this forum. I am not sure if 3 days is normal, so I am sending out a plea again.

Thank you in advance.

orangeudav’s picture

same problem, but after the form was reloaded by ahah, my page2, page3 etc links looks like

http://server/site/master/3/js?page=1&cams_counter-1598=1&cams_counter-1599=1&cams_counter-1600=1&cams_counter-1601=1&cams_counter-1602=1&cams_counter-1603=1&cams_counter-1604=1&cams_counter-1605=1&cams_counter-1606=1&cams_counter-1607=1&types[45]=45&form_build_id=form-1200b7fef2cf15c015f20f30d8763dee&form_token=63e09ed68743f05ed1d0f3bf2375ab26&form_id=master_page_3_form
duckzland’s picture

this is classic ahah bubbling problem, try to reload the js in the callback function parse it to drupal_add_js().
if the page button is going to be drupal form ahah (not custom ajax + jQuery) then you need to check quicktabs_ahah.js for fixing ahah creates ahah problem.

If its a custom ajax + jQuery that didnt call ahah.js then you need to load the custom js again when the page is reloaded using ahah.

--------------------------------------------------------------------------------------------------------
if you can use drupal why use others?
VicTheme.com