This patch provide new feature for ahah.
Example:
$form['wrapper']['wrapper_process']['submit'] = array(
'#type' => 'submit',
'#value' => t('Attach'),
'#id' => 'attach',
'#ahah' => array(
'path' => 'mymodule/upload_js',
'wrapper' => 'mymodule-wrapper-process',
'method' => 'replace',
'effect' => 'slide',
'progress' => array('type' => 'wrapper', 'update_callback' => 'mymodule_upload', 'interval' => 1000, 'url' => 'mymodule/uploadstatus_js/', 'wrapper' => 'mymodule-wrapper-process'),
),
);
Where:
mymodule-wrapper-process -
mymodule_upload - javascript. For example:
function mymodule_upload(wrapper,answer) {
var div = document.createElement('div');
div.className = 'progress';
$(div).html('
'+
'
'+
'
');
$('div.filled', div).css('width', answer.percentage +'%');
$('div.percentage', div).html(answer.percentage +'%');
$('div.message', div).html(answer.message);
$(wrapper).empty();
$(wrapper).append(div);
}
So, every 'interval' your javascript will be called by ahah and you can customize progress output and put it into defined div.
| Comment | File | Size | Author |
|---|---|---|---|
| wrapper.patch | 2.8 KB | gor |
Comments
Comment #1
stokito commentedI am don't think that this is very need. Maybe make it as a module?
Comment #2
gor commentedI am don't think that it is possible.
Comment #3
lilou commentedFeature request go to CVS/HEAD.
Comment #4
dawehnerAhah is replaced by #ajax
Comment #5
damien tournoud commentedEither I'm totally missing the point, or this has been possible all along (see for example, the upload progress indicator of FileField on Drupal 6).