Ajax Forms API
Component ID
2230755
Component name
Ajax Forms API
Component type
module
Maintenance status
Development status
Component security advisory coverage
not-covered
Downloads
1263
Component created
Component changed
Component body
Do you need submit the default Drupal form dynamically via AJAX? You got it. AJAX Forms API provides simple API to handle forms with AJAX. You just need add one or two parameters in hook_form_alter and your form will be sent dynamically.
How to use
- Implement hook_form_alter() in your module.
- For certain form add following code, example:
function my_module_form_alter(&$form, &$form_state, $form_id) { if ($form_id == 'article_node_form') { // Make form as AJAX form. $form['#ajax_api'] = TRUE; // Message which will be displayed after successful submitting. $form['#ajax_api_success_message'] = t('AJAX API message.'); } } - Enjoy. Your form will be automatically validated via AJAX, after successful submitting you will see defined message.
