Skip to main content
added 24 characters in body
Source Link
Vlasin
  • 360
  • 3
  • 16

This thing causes the problem that the form is not submitted/saved :

 $form['actions']['submit'] = array (
        '#prefix' => '<button type="submit">',
        '#suffix' => '</button></li></ul>',
        '#markup' => '<span>' . t('Say your piece') . '</span>'
     );

    $form['#action'] = $_SERVER['REQUEST_URI'];

Is there any possibility to save the comment on the node page ? ( to not be redirected to /comment/reply/$nid)

This thing causes the problem that the form is not submitted/saved :

 $form['actions']['submit'] = array (
        '#prefix' => '<button type="submit">',
        '#suffix' => '</button></li></ul>',
        '#markup' => '<span>' . t('Say your piece') . '</span>'
     );

    $form['#action'] = $_SERVER['REQUEST_URI'];

Is there any possibility to save the comment on the node page ? ( to not be redirected to /comment/reply/$nid)

added 597 characters in body
Source Link
Vlasin
  • 360
  • 3
  • 16
$form['comment_body'] global $user;
     if ($user->uid) {
       $form['author']['_author'] = array
     (
    '#type'    '#tittle' => 'textarea''Name',
        '#attributes' => array('id'=>array('comment''name')),
        '#prefix' =>=>'<ul> '<li<li class="comment_field_c"><labelclass="name_field_c"><label for="comment">Comment<for="name">Name</label>'.$form['author']['_author']['#markup'],
        '#suffix' => '</li>',
    '#weight' =>); 4,
   
  '#resizable' => FALSE
 );}
     else {
 $form['author']    $form['author']['name'] = array
     (
        '#type' =>'textfield',
        '#attributes' => array('id'=>array('name')),
        '#prefix' =>'<ul> <li class="name_field_c"><label for="name">Name</label>',
        '#suffix' => '</li>'
     );
   
 $form['author']['homepage']['#access'] = FALSE;  }
 $form['subject']['#access'] = FALSE;  
 $form['mail']    $form['author']['mail'] = array(
        '#type' =>'textfield',
        '#attributes' => array('id'=>array('email')),
        '#prefix' => '<li class="email_field_c"><label for="email">Email (optional)</label>',
        '#suffix' =>'</li>',
        '#required'=>TRUE,
        '#weight' => 2
     );
     
    $form['comment_body'] = array
     (
        '#type' => 'textarea',
        '#attributes' => array('id'=>array('comment')),
        '#prefix' => '<li class="comment_field_c"><label for="comment">Comment</label>',
        '#suffix' => '</li>',
        '#weight' => 4,
        '#resizable' => FALSE
     );
  
  
     $form['author']['homepage']['#access'] = FALSE;
     $form['subject']['#access'] = FALSE;
  
  
     $form['captcha']['#prefix'] = '<li><div class="captcha">';
     $form['captcha']['#suffix'] = '</div>';
     $form['actions']['submit'] = array (
        '#prefix' => '<button type="submit">',
        '#suffix' => '</button></li></ul>',
        '#markup' => '<span>' . t('Say your piece') . '</span>'
     );

    $form['#action'] = $_SERVER['REQUEST_URI'];
$form['comment_body'] = array
 (
    '#type' => 'textarea',
    '#attributes' => array('id'=>array('comment')),
    '#prefix' => '<li class="comment_field_c"><label for="comment">Comment</label>',
    '#suffix' => '</li>',
    '#weight' => 4,
    '#resizable' => FALSE
 );
 
 $form['author'] = array
 (
    '#type' =>'textfield',
    '#attributes' => array('id'=>array('name')),
    '#prefix' =>'<ul> <li class="name_field_c"><label for="name">Name</label>',
    '#suffix' => '</li>'
 );
  
 $form['author']['homepage']['#access'] = FALSE;
 $form['subject']['#access'] = FALSE;
 $form['mail'] = array(
    '#type' =>'textfield',
    '#attributes' => array('id'=>array('email')),
    '#prefix' => '<li class="email_field_c"><label for="email">Email (optional)</label>',
    '#suffix' =>'</li>',
    '#required'=>TRUE,
    '#weight' => 2
 );
  
  
 $form['captcha']['#prefix'] = '<li><div class="captcha">';
 $form['captcha']['#suffix'] = '</div>';
 $form['actions']['submit'] = array (
    '#prefix' => '<button type="submit">',
    '#suffix' => '</button></li></ul>',
    '#markup' => '<span>' . t('Say your piece') . '</span>'
 );

$form['#action'] = $_SERVER['REQUEST_URI'];
 global $user;
     if ($user->uid) {
       $form['author']['_author'] = array
     (
        '#tittle' => 'Name',
        '#attributes' => array('id'=>array('name')),
        '#prefix' =>'<ul> <li class="name_field_c"><label for="name">Name</label>'.$form['author']['_author']['#markup'],
        '#suffix' => '</li>'
     );    
     }
     else {
     $form['author']['name'] = array
     (
        '#type' =>'textfield',
        '#attributes' => array('id'=>array('name')),
        '#prefix' =>'<ul> <li class="name_field_c"><label for="name">Name</label>',
        '#suffix' => '</li>'
     );  
     }
     
     $form['author']['mail'] = array(
        '#type' =>'textfield',
        '#attributes' => array('id'=>array('email')),
        '#prefix' => '<li class="email_field_c"><label for="email">Email (optional)</label>',
        '#suffix' =>'</li>',
        '#required'=>TRUE,
        '#weight' => 2
     );
     
    $form['comment_body'] = array
     (
        '#type' => 'textarea',
        '#attributes' => array('id'=>array('comment')),
        '#prefix' => '<li class="comment_field_c"><label for="comment">Comment</label>',
        '#suffix' => '</li>',
        '#weight' => 4,
        '#resizable' => FALSE
     );
  
  
     $form['author']['homepage']['#access'] = FALSE;
     $form['subject']['#access'] = FALSE;
  
  
     $form['captcha']['#prefix'] = '<li><div class="captcha">';
     $form['captcha']['#suffix'] = '</div>';
     $form['actions']['submit'] = array (
        '#prefix' => '<button type="submit">',
        '#suffix' => '</button></li></ul>',
        '#markup' => '<span>' . t('Say your piece') . '</span>'
     );

    $form['#action'] = $_SERVER['REQUEST_URI'];
Source Link
Vlasin
  • 360
  • 3
  • 16

Alter the comment form

I have the following code to alter the way comment form is displayed. After the bellow code everything is displayed as i want to but it does not add the comments.

$form['comment_body'] = array
 (
    '#type' => 'textarea',
    '#attributes' => array('id'=>array('comment')),
    '#prefix' => '<li class="comment_field_c"><label for="comment">Comment</label>',
    '#suffix' => '</li>',
    '#weight' => 4,
    '#resizable' => FALSE
 );
 
 $form['author'] = array
 (
    '#type' =>'textfield',
    '#attributes' => array('id'=>array('name')),
    '#prefix' =>'<ul> <li class="name_field_c"><label for="name">Name</label>',
    '#suffix' => '</li>'
 );
 
 $form['author']['homepage']['#access'] = FALSE;
 $form['subject']['#access'] = FALSE;
 $form['mail'] = array(
    '#type' =>'textfield',
    '#attributes' => array('id'=>array('email')),
    '#prefix' => '<li class="email_field_c"><label for="email">Email (optional)</label>',
    '#suffix' =>'</li>',
    '#required'=>TRUE,
    '#weight' => 2
 );
  
  
 $form['captcha']['#prefix'] = '<li><div class="captcha">';
 $form['captcha']['#suffix'] = '</div>';
 $form['actions']['submit'] = array (
    '#prefix' => '<button type="submit">',
    '#suffix' => '</button></li></ul>',
    '#markup' => '<span>' . t('Say your piece') . '</span>'
 );

$form['#action'] = $_SERVER['REQUEST_URI'];

To submit the form i have to press twice on the submit button ( how can i solve it ? ) and after i submit the form again i get the following errors and i cannot figure it out how to solve them:

Warning: array_values() [function.array-values]: The argument should be an array in _field_filter_items() (line 513 of /home/mcristi/public_html/jhub/modules/field/field.module).
Warning: Invalid argument supplied for foreach() in text_field_validate() (line 119 of /home/mcristi/public_html/jhub/modules/field/modules/text/text.module).
Notice: Undefined index: homepage in comment_form_validate() (line 2155 of /home/mcristi/public_html/jhub/modules/comment/comment.module).