Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function helper_menu() {
- $items['test'] = array(
- 'title' => 'test',
- 'page callback' => 'helper_page_forms',
- 'access arguments' => array('access content'),
- );
- return $items;
- }
- function helper_page_forms() {
- $build['form1'] = drupal_get_form('helper_form1');
- $build['form2'] = drupal_get_form('helper_form2');
- return $build;
- }
- function helper_form1($form, &$form_state) {
- $form['submit'] = array(
- '#type' => 'submit',
- '#value' => 'Submit 1',
- '#ajax' => array(
- 'callback' => 'helper_form1_ajax',
- ),
- );
- return $form;
- }
- function helper_form2($form, &$form_state) {
- $form['submit'] = array(
- '#type' => 'submit',
- '#value' => 'Submit 2',
- '#ajax' => array(
- 'callback' => 'helper_form2_ajax',
- ),
- );
- return $form;
- }
- function helper_form1_ajax() {
- return array(
- '#type' => 'ajax',
- '#commands' => array(
- ajax_command_alert('ajax 1'),
- ),
- );
- }
- function helper_form2_ajax() {
- return array(
- '#type' => 'ajax',
- '#commands' => array(
- ajax_command_alert('ajax 2'),
- ),
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement