AJax FAPI

Wyze1 - March 19, 2008 - 05:32

Hi Drupallers

I need assistance with the following I have a form:

function the_form() {
$form['name'] = array(
'#type' => 'textfield',
'#title' => t('Name'),
);

$form['surname'] = array(
'#type' => 'textfield',
'#title' => t('Name'),
);

$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
);
return $form;
}

Firstly how would I go about setting adding the following to the form element onsubmit="sendData( )" return false

Secondly How would one go about getting the values of the text field and return a status message with ajax!

FAPI #AHAH fields...

Shnapoo - March 19, 2008 - 14:23

Perhaps you'd like to have a look at http://api.drupal.org/api/file/developer/topics/forms_api_reference.html...

The FAPI AHAH concept makes most (if not all) AJAX-alike features really easy to implement with Drupal.

 
 

Drupal is a registered trademark of Dries Buytaert.