How to create forms that are submitted via ajax. To understand this tutorial you have to have a basic knowledge of Drupal programming and its form api.
Simple form which has name field and submit button. In result it prints the name you inserted and every time you submit the form again it changes.
All ajax options:Source code viewer
function HOOK_form($form, &$form_state) { '#title' => 'Name', '#type' => 'textfield', '#description' => 'Your name.', '#prefix' => '<div id="RESULT_DIV_ID">', '#suffix' => '</div>', ); '#type' => 'submit', '#value' => 'Submit', 'callback' => 'CALLBACK_FUNCTION_NAME', 'wrapper' => 'RESULT_DIV_ID', ), ); return $form; } function CALLBACK_FUNCTION_NAME($form, &$form_state) { return '<div id="RESULT_DIV_ID">Your name is :'.$form_state['values']['name'].'</div>'; }Programming Language: PHP