Client-Side form validation issue with Fivestar module? I've set up my review system of my Drupal 7.x site some what like mentioned in this http://drupal.org/node/1308114 and I've also set that field as "Required" but it seems that "Required Field" is not working since, its allowing user to submit the review without rating the article, for that I've created my custom module containing 

&lt;?php
/**
 * Implementation of hook_form_alter()
 */
function rishihrvalidate_form_alter(&amp;$form, $form_state, $form_id) {
    $form['#attributes']['onsubmit'] = 'return comment_cs_validate()';
    if ($form_id == 'comment-form'){
  } 
}


calling the JavaScript

&lt;script type="text/javascript"&gt;
      function comment_cs_validate() {
        if ($('#edit-field-review-value div div').hasClass("on") &amp;&amp; $('#edit-field-review-atmosphere div div').hasClass("on") &amp;&amp; $('#edit-field-review-service div div').hasClass("on")) {
          return true;
        }
        else {
          alert ('You must rate the listing before submitting your review');
          return false;
        }
      }
    &lt;/script&gt;


Though the above PHP code was not perfect, it was executing correctly and behaving as desired only the problem I'm getting is while logging on my site also its taking place since I've called all the submit buttons, hence I changed the from that above one to this, but now I'm getting nothing, may I know where I might be lacking?

&lt;?php
/**
 * Implementation of hook_form_alter()
 */
function rishihrvalidate_form_alter(&amp;$form, &amp;$form_state, $form_id) {
    if ($form_id == 'comment_form') {
        $form['#attributes']['onsubmit'] = 'return comment_cs_validate()';
    }
}


I'm not getting where is the mistake, can someone help me in this issue?

Thanks in Advance :)
Perhaps you are using the wrong $form_id

One way to check is to use Database Logging, also known as the Watchdog or Recent Log Entries, to log the $form_id. After you add this code, execute the form by performing a submit, and then check your Reports > Recent Log Entries area for the result. This may require enabling the Database Logging core module before the messages are logged and/or visible.

&lt;?php
/**
 * Implementation of hook_form_alter()
 */
function rishihrvalidate_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  // Log the $form_id to the watchdog
  // in this example, 'form_id' is just the log entry name. I commonly use 'wtf'
  watchdog('form_id', $form_id);

  if ($form_id == 'comment_form') {
    $form['#attributes']['onsubmit'] = 'return comment_cs_validate()';
  }
}
?&gt;


For more information about watchdog, visit http://api.drupal.org/api/function/watchdog