0

I am using Form API to create a form on a page and I ask user to submit CSV File which is then process in _submit function for that form. Kindly suggest me a way to add progress bar with Drupal's way. I tried this actually but did not work.

function userop_form_users($form_state) {

  $form['file'] = array(
    '#type' => 'file',
    '#title' => t("Upload CSV file containing information."),
    '#description' => t('<a href="#">Download sample file</a>.<br>Upload a file, allowed extensions: csv'),
    '#ajax' => array(
        'progress' => array('type' => 'bar', 'message' => t('TestMessage'),'interval' => '1500'),
     ),
    );

  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
  );

  $form['#cache'] = FALSE;
  return $form;
}
6
1

The easiest way would be to use the managed_file field type and set the #progress_indicator property to 'bar'.

More details are given in this Drupal Answers 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.