Asaf (ajax submit for any form)


Currently we have no time to maintain this module so we are looking for co-maintainer!

This module is used to AJAX-ify form submissions. It can both AJAX-ify existing forms (without writing any code) and build your own forms starting from simple AJAX forms to complex dynamic forms with dependent components or multistep behaviors.

Features:

  • Uses Drupal core AJAX engine (more info: AJAX Forms in Drupal 7 and Ajax framework commands);
  • Shows validation error messages above the form;
  • Supports forms with redirects (redirect/drupal_goto), and batch processing (Batch API);
  • Supports page cache (works correctly when the page with a form is cached);
  • Submits a form by pressing Enter (should be enabled in module settings);
  • Provides flexible API for developers to customize submission results output, form parts redrawing, control error messages position, etc.

Asaf GUI

On the module settings page (admin/config/system/asaf) put a list of form IDs into "Forms" field to configure which forms to AJAX-ify. Tick “Show form ids” checkbox to see form IDs of all forms on any page.

If you want to AJAX-ify only certain buttons on the form, you can list them using the following syntax: photo_node_form@+submit (AJAX-ifies only submit button on the photo_node_form) or photo_node_form@-preview (AJAX-ifies ALL buttons except for preview button on the photo_node_form).

Asaf API

Being a FormAPI AJAX engine wrapper, Asaf module is a micro framework. It handles all low level work needed to build an AJAX form like specifying wrappers, implementing and registering ajax_callback functions and building #ajax attribute, giving a developer a higher level abstraction layer.

On this level every form consists of controls and redrawable areas. A control is any form element with #asaf_control attribute that initiates AJAX form submission. Redrawable area - any part of the form with a #asaf_area attribute which can be redrawn upon any event sent by a control. The whole form also is a redrawable area. A list of area IDs as well as one area ID could be specified in the #asaf_target_area attribute of any control. If this attribute is empty the whole form will be redrawn. This allows you to build complex dynamic forms very easily using just area IDs.

Since ASAF module uses the core FormAPI AJAX engine, the server responses with AJAX-commands. ASAF module provides two hooks to fully control server response:

  • HOOK_asaf_form_ajax_commands_alter
  • HOOK_asaf_form_FORM_ID_ajax_commands_alter

There is an asaf_example submodule inside Asaf module which is a basic example of how to use ASAF API properly.

Sponsored and developed by Ardas Group Inc.


Asaf (ajax submit for any form)项目的Drush安装命令:复制到剪贴板

注:个别模块仍需开启相关子模块。

项目分类:

周安装量: 
791
维护状态: 
正在寻找项目共同维护者
开发状态: 
仅修复BUG,不添加新功能

推荐版本下载:

版本下载地址发布日期发布说明翻译下载
7.x-1.1tar.gz (19.89 KB) | zip (27.16 KB)2013年6月6日发布说明简 | 繁 | 更多

开发版本下载:

版本下载地址发布日期发布说明翻译下载
7.x-1.x-devtar.gz (19.95 KB) | zip (27.23 KB)2013年9月30日发布说明简 | 繁 | 更多