no preview button (how to enable the submit button instead)
chiefguest - November 8, 2007 - 21:31
| Project: | Usernode Guestbook |
| Version: | 5.x-1.x-dev |
| Component: | User interface |
| Category: | support request |
| Priority: | critical |
| Assigned: | MarcoR |
| Status: | closed |
Jump to:
Description
sorry to post this here, but i didnt thought any other place would be as relevant as this
I have installed usernode guestbook and nothing went wrong (no script errors) but when i check the user node or user profile i see fields to input the comments for user but i dont see a link for submit. I mean the submit text doesnt have the hyperlink its just the text. I do know what to do so am here submitting for your help.
thanks

#1
#2
#3
Usernode guestbook uses the original comment buttons to post a guestbook entry like a comment. Due to some ugly nesting in preview mode (the preview is rendered like a comment and the comment itself is rendered inside of this again) I disabled the preview mode, because I currently see no well designed solution for this. Our Drupal gurus may know what to do here and I will change this as soon as I know.
Until then it is advised to let users submit comments without previewing. I suppose the problem is that you have set comment previewing to required. So here's my advice:
Recommended configuration
Please post if it helped you.
#4
Will be fixed in next dev version. Even if preview is required for comments usernode guestbook entries will have a submit button.
Preview is not possible yet due to a rendering problem. We need a more elegant solution for this instead of complete rewrite of the form.
Old or potentially new code is commented out.
<?php/**
* Implementation of hook_form_alter to change appearence of comment_form
* especially for usernodes.
*
* @param string $form_id
* name of the form
* @param array $form
* editable form array by reference
*/
function usernode_guestbook_form_alter($form_id, &$form) {
if ($form_id == 'comment_form') {
$node = node_load(array('nid' => $form['nid']['#value']));
if ($node->type == 'usernode') {
unset($form['subject']);
$form['comment_filter']['comment']['#rows'] = 3;
$form['comment_filter']['comment']['#title'] = t('Leave a message');
/*
if (variable_get('comment_preview', COMMENT_PREVIEW_REQUIRED) == COMMENT_PREVIEW_OPTIONAL) {
unset($form['preview']);
}
else {
$op = isset($_POST['op']) ? $_POST['op'] : '';
$form['preview']['#value'] = t('Preview');
if ($op == t('Preview')) {
$form['#after_build'] = array('comment_form_add_preview');
$form['submit'] = array('#type' => 'submit', '#value' => t('Submit'), '#weight' => 20);
}
}
*/
// Previewing is ugly because the form is rendered as a comment
// and preview is rendered inside of this again. Always show submit button.
unset($form['preview']);
$form['submit'] = array('#type' => 'submit', '#value' => t('Submit'), '#weight' => 20);
$form['#redirect'] = _usernode_guestbook_redirect($node->uid, 'comments');
}
}
}
?>
#5
committed into latest dev version.
#6
Automatically closed -- issue fixed for two weeks with no activity.