I'm trying to create a form in a block to enable users to add new messages. Here's my code so far, for a 'request to post' message type:
function MYMODULE_block_view($name) {
if ($name == 'add_request_to_post_message') {
$content['content'] = drupal_get_form('message_ui_instance_message_manage','request_to_post');
return $content;
}
}
which seems to work fine, although it's not a massively elegant solution.
The bit I'm not struggling with is an ajax submission. In the above, I've tried amending the form in various ways, but with no success:
//first attempt
$content['content']['actions']['submit']['#ajax'] = array(
'callback' => 'MYMODULE_form_submit',
'wrapper' => 'form-register-message'
);
//second attempt
$content['content']['#submit']['#ajax'] = array(
'callback' => 'MYMODULE_form_submit',
'wrapper' => 'form-register-message'
);
This is the callback:
function MYMODULE_form_submit($form, &$form_state) {
$element = $form;
if(!form_get_errors()) {
$element = t('Thanks for registering. We will contact you soon');
}
return $element;
}
Can anyone help?
Closed: works as designed
1.4
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.