function ajax_example_progressbar_form
Implements hook_FORMID().
Build a landing-page form for the progress bar example.
See also
https://api.drupal.org/api/drupal/developer%21topics%21forms_api_refereā¦
1 string reference to 'ajax_example_progressbar_form'
- ajax_example_menu in ajax_example/
ajax_example.module - Implements hook_menu().
File
-
ajax_example/
ajax_example_progressbar.inc, line 15
Code
function ajax_example_progressbar_form($form, &$form_state) {
$form_state['time'] = REQUEST_TIME;
// We make a DIV which the progress bar can occupy. You can see this in use
// in ajax_example_progressbar_callback().
$form['status'] = array(
'#markup' => '<div id="progress-status"></div>',
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
'#ajax' => array(
// Here we set up our AJAX callback handler.
'callback' => 'ajax_example_progressbar_callback',
// Tell FormAPI about our progress bar.
'progress' => array(
'type' => 'bar',
'message' => t('Execute..'),
// Have the progress bar access this URL path.
'url' => url('examples/ajax_example/progressbar/progress/' . $form_state['time']),
// The time interval for the progress bar to check for updates.
'interval' => 1000,
),
),
);
return $form;
}