I have a custom form in Drupal that ties into Entity-generating code. In essence, there's a button which should return an ideal Entity state (determined in a method that returns true or false).
The code below fires the method in question, but even if it gets a return value from the method, the value of the button never changes.
Am I overlooking something as simple as returning a new #value in the AJAX callback?
function example_mark_block_form($form, $form_state) {
$form = array();
$is_marked = _example_is_user_marked();
$form['mark-changes'] = array(
'#type' => "button",
'#id' => "mark-changes",
'#default_value' => t($is_marked),
'#prefix' => "<div class='mark-wrapper'>",
'#suffix' => "</div>",
'#ajax' => array(
'callback' => 'example_mark_follow_ajax_response',
'wrapper' => 'mark-wrapper',
'method' => 'replace',
),
);
return $form;
}
/**
* AJAX callback for the follow response
*/
function example_mark_follow_ajax_response($form, $form_state) {
global $user;
return $form['mark-changes'];
}