[development] FW: Webform Ajax - D7

Idan Arbel idan at arbel-designs.com
Sun Jul 31 16:22:53 UTC 2011


 

 

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20110731/0b5e25a5/attachment.html 


More information about the development mailing list