0

Drupal 7 - Created a module that lists out a bunch of tabular data from an external oracle database. The list has a number of select boxes to narrow down criteria. After setting up the menu file I have the following callbacks:

function listAll($form,&$form_state) {
    //Page callback for drupal_get_form


    $form['semesterSelect'] = array(
        '#type' => 'select',
        '#title' => 'Semester',
        '#options' => array('Fall','Winter','Spring','Summer'),
        '#default_value' => 'Fall',
        '#ajax' => array(
            'callback' => 'callbackSemesterSelect',
            'wrapper' => 'courseListDiv',
        ),
    );

    $form['courseList'] = array(
        '#type' => 'markup',
        '#prefix' => '<div id="courseListDiv">',
        '#suffix' => '</div>',
    );

    if (!empty($form_state['values']['semesterSelect'])) {
        $form['courseList']['#markup'] = getCourseTable();
    } else {
        $form['courseList']['#markup'] = 'Select a semester';
    }

    return $form;
}

function callbackSemesterSelect($form, $form_state) {   
    return $form['courseList'];
}

function getCourseTable() {

/***
* This function uses ob_start() and ob_get_clean() to return an HTML formatted table
*/

}

What I have noticed is that if my table goes over 30 or so rows the output ends up being an empty div where courseListDiv was previously. When its under 30 rows it displays the courseList element with prefix/suffix as expected. Is the output buffering causing this? is there a limit on ajax data or something in drupal that might be causing this?

  • After more testing and adding a few watchdog calls it appears the data makes it all the way to the callback function - somewhere in drupal where it processes the ajax return object it looses that data. – LVDuke Mar 6 '12 at 22:18
0

Turns out there was some UTF8 encoding in a field that was causing the output to not be rendered. Appears to be something in the output buffering that caused this and not drupal. Adding a utf8_decode when the fields print has resolved the issue.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.