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