Closed (fixed)
Project:
ZURB Foundation
Version:
7.x-4.x-dev
Component:
User interface
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
23 Apr 2013 at 09:01 UTC
Updated:
7 May 2013 at 15:20 UTC
Hello,
I am trying to create webform and use AJAX submition in it. I found code that perfectly work in Bartik and Zen themes. I try it for Zenfoundation but it did not update the form.
I use this code in template.php:
function zurblike_form_alter(&$form, &$form_state, $form_id) {
// see if webform_client_form_ is in the form_id
if(strstr($form_id, 'webform_client_form_')) {
// get the nid so we can use it in the wrapper value
$nid = $form['#node']->nid;
// add the ajax properties to the submit button
$form['actions']['submit']['#ajax'] = array(
'callback' => 'zurblike_webform_js_submit',
'wrapper' => 'webform-client-form-' . $nid,
'method' => 'replace',
'effect' => 'fade',
);
}
}
function zurblike_webform_js_submit($form, $form_state) {
// define the $sid variable (submission id from webform)
$sid = $form_state['values']['details']['sid'];
// if we have a sid then we know the form was properly submitted, otherwise, we'll just return the existing $form array
if ($sid) {
// first we have to load up the webform node object
$node = node_load($form_state['values']['details']['nid']);
// create an array up with the confirmation message, retreived from the webform node
$confirmation = array(
'#type' => 'markup',
'#markup' => check_markup($node->webform['confirmation'], $node->webform['confirmation_format'], '', TRUE),
);
// return the confirmation message
return $confirmation;
}
else {
// return the form
return $form;
}
}
Can any one help? Why this code does not popely work in Zurb Foundation?
Comments
Comment #1
ishmael-sanchez commentedHi vitkuz,
Did you review this issue, #1779484: Depends on jquery 1.7 or on the project page it lists known issues I'm pretty sure it's related to jQuery version can you follow the advice on the project page and/or the link to the issue I posted and see if that corrects your problem. If not post additional information and change the status, Thanks.