This is OT for this list. This list is reserved for discussions of Drupal core development. Please move your query to support@drupal.org and see http://drupal.org/support and http://drupal.org/community for more options. Idan Arbel wrote:
Hello,
I'm trying to get a webform to send the data via ajax on drpual 7.
I've added this code into my template.php file. It seems to work well except for the fact that the data isn't saved at the end.
What am I missing?
function enjoon_form_alter(&$form, &$form_state, $form_id) { if($form_id == 'webform_client_form_32'){ $form['actions']['submit'] = array( '#type' => 'submit', '#ajax' => array( 'callback' => 'enjoon_ajax_callback', 'wrapper' => str_replace('_','-',$form['#form_id']), 'effect' => 'fade', ), '#value' => t('Submit'), ); } }
function enjoon_ajax_callback($form, $form_state) {
if(form_get_errors()){ return $form; } else{ return 'Thank you!'; } }
Thanks
Idan
-- Earnie -- http://progw.com -- http://www.for-my-kids.com