Blog Tags
Blog Archiv
- April, 2010 (1)
- Dezember, 2009 (2)
- November, 2009 (4)
Drupal 6 AHAH Formular mit Dateiupload
Drupal 6 kennt im Zusammenhang mit AHAH-Formularen 2 Möglichkeiten um die Response zu senden.
Wid mit einem AHAH-Forrmular ein Dateiupload realisiert kann von beiden nur eine Möglichkeit angewendet werden.
Möglichkeit 1
drupal_set_message('The form has been saved.', $type = 'status');
$output = theme('status_messages', 'status') . drupal_render($form);
print drupal_json(array('status' => TRUE, 'data' => $output));
exit();
Möglichkeit 2
drupal_set_message('The form has been saved.', $type = 'status');
$output = theme('status_messages', 'status') . drupal_render($form);
print drupal_to_js(array('status' => TRUE, 'data' => $output));
exit();
AHAH mit Dateiupload
function sample_upload_form() {
$form = array();
$form['#attributes'] = array('enctype' => "multipart/form-data");
$form['sample']['upload'] = array(
'#type' => 'file',
'#title' => t('Attach new file'),
'#size' => 40,
);
$form['attach'] = array(
'#type' => 'submit',
'#value' => t('Attach'),
'#ahah' => array(
'path' => 'sample/upload',
'wrapper' => 'sample-upload-form',
'method' => 'replace',
),
);
return $form;
}
Hierbei muss in der Callback-Funktion Möglichkeit 2 angewendet werden.
Kommentare
nfl football
nfl football jerseys,
authentic nfl jerseys,
nfl replica jerseys,
nfl throwback jerseys,
custom nfl jerseys,
reebok nfl jerseys,
hockey jerseys,
team hockey jerseys,
baseball jerseys,
basketball jerseys,