function makemeeting_answer_js in Make Meeting Scheduler 7.2
Ajax callback in response to an answer that has been edited.
This returns the new form content to replace the form content made obsolete by the form submission.
1 string reference to 'makemeeting_answer_js'
- makemeeting_answers_form in ./
makemeeting.form.inc - Form callback: enables users to answer a makemeeting poll
File
- ./
makemeeting.module, line 111 - Hooks and field implementations
Code
function makemeeting_answer_js($form, $form_state) {
$values = $form_state['values'];
$answer = $values['answer_edited'];
$entities = entity_load($answer->entity_type, array(
$answer->entity_id,
));
if (empty($entities)) {
return drupal_not_found();
}
$entity = $entities[$answer->entity_id];
$field = $entity->{$answer->field_name}[$answer->language][$answer->delta];
// We need to empty POST data to prevent the form
// from being processed as submitted
$_POST = array();
$new_form = drupal_get_form('makemeeting_answers_form_' . $answer->entity_id, $field, $values);
// AJaX processing overrides form action, now retrieving the correct one
$query = parse_url($form['#action']);
$parameters = drupal_get_query_array($query['query']);
$new_form['#action'] = $parameters['destination'];
return $new_form;
}