StudioPress Community Forums
  StudioPress Community Forums > Forums > General Discussion
For help and support, access to your downloads, or to manage your account please log into My StudioPress.

These forums have been set to read-only so you can browse the existing topics for any questions you may have.

For general discussion on WordPress, CSS and design (NOT for support) visit the new Community Forums.
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 09-20-2012, 10:36 AM
PKatSP PKatSP is offline
Registered User
Genesis Member
 
Join Date: Oct 2011
Posts: 14
Default Comment form validation / filter breaks comment form ID

I have been setting up jQuery validation for the comment form... Everything would be fine if applying a filter (as in add_filter( 'genesis_comment_form_args', 'comment_form_args' ); in the functions.php wouldn't break the form id.

this is what I have in the functions.php:
Quote:
add_filter( 'genesis_comment_form_args', 'comment_form_args' );
function comment_form_args( $args ){
$commenter = wp_get_current_commenter();
$req = get_option( 'require_name_email' );
$args = array(
'fields' => array(
'author' =>
'<p class="comment-form-author">' .
'<label for="author">' . 'Name:' . '</label> ' .
'<input id="author" name="author" class="commentfield required name" type="text" value="' .
esc_attr( $commenter['comment_author'] ) .
'" size="30" tabindex="1"' .
' />' .
( $req ? '<span class="requiredspan">* Required</span>' : '' ) .
'</p><!-- #form-section-author .form-section -->',

'email' =>
'<p class="comment-form-email">' .
'<label for="email">' . 'E-mail:' . ' </label> ' .
'<input id="email" class="commentfield email" name="email" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30" tabindex="2"' . ' />' .
( $req ? '<span class="requiredspan">* Required, but will not be visible.</span>' : '' ) .

'</p><!-- #form-section-email .form-section -->',

'url' => '<p class="comment-form-url">' .
'<label for="url">' . 'Web:' . '</label> ' .
'<input id="url" name="url" type="text" class="commentfield" value="' . esc_attr( $commenter['comment_author_url'] ) . '" tabindex="3" />' .
'<p class="urllink">Your comment will include a publically visible link ("behind" your <br/>name) to any internet address you may specify above... </p>' .
'</p><!-- #form-section-url .form-section -->'
),

'comment_field' => '<p class="comment-form-comment">' .
'<textarea id="comment" name="comment" rows="8" tabindex="4" aria-required="true" title="Enter Message..."></textarea>' .
'</p><!-- #form-section-comment .form-section -->',

'title_reply' => 'Your Comment',
'comment_notes_before' => '',
'comment_notes_after' => '<p id="moderated">Please note that comments are moderated.</p>',
'label_submit' => 'Submit',
'cancel_reply_link' => __( 'Cancel' )
);

$args['fields']['author'] = 'author_display' ? $args['fields']['author'] : '';
$args['fields']['email'] = 'email_display' ? $args['fields']['email'] : '';
$args['fields']['url'] = 'url_display' ? $args['fields']['url'] : '';

/** Merge $args with $defaults */
return $args;
}
Works fine... HOWEVER, I have noticed (via Safari/Inspect) that if the above code is in the functions.php the first line of the form appears as this:

Quote:
<form action="http://theorderofthought.com/wp-comments-post.php" method="post" id="">
In other words the id gets "nulled" as it were — the regular id="commentform" is gone and so I can not hook my jQuery to it.

If I delete the above code from the functions.php the form returns to
Quote:
<form action="http://theorderofthought.com/wp-comments-post.php" method="post" id="commentform">
Any help to rectify this would be much appreciated! PLEASE!! :)
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with comment form changes Glenys General Discussion 3 07-03-2010 07:40 PM
CSS and comment form fahrni General Discussion 2 07-02-2009 03:01 AM
Comment Link Doesn't Show Comment Form ujesse General Discussion 4 01-26-2009 06:36 PM


All times are GMT -5. The time now is 01:02 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.