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
No answers, Is this Impossible or Just a dumb question?
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.
same problem, but after the
same problem, but after the form was reloaded by ahah, my page2, page3 etc links looks like
this is classic ahah bubbling
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