Support » Fixing WordPress » Comment form automatically adds website

  • In my comments, when a user adds their name, email, and comment (but NO website), the comment automatically adds the website for the value of the field.

    Here is my code:

    <input id="url" type="text" name="url" class="focus" onfocus="if(this.value=='web') this.value='';" onblur="if(this.value=='') this.value='web';" value="web" tabindex="3" />

    It automatically adds ‘http://web.com&#8217; to the persons name if they does not add their website.

    Any workaround?

Viewing 5 replies - 1 through 5 (of 5 total)
  • CHANGE:

    <input id="url" type="text" name="url" class="focus" onfocus="if(this.value=='web') this.value='';" onblur="if(this.value=='') this.value='web';" value="web" tabindex="3" />

    TO:

    <input id="url" type="text" name="url" class="focus" onfocus="if(this.value=='web') this.value='';" value="web" tabindex="3" />

    You rock. That did the trick.

    I’m having the same problem.

    In my comments, when a user adds their name, email, and comment (without a website), the comment automatically adds the website for the value of the field. It adds http://Website

    <?php if(!$jquery): ?><label for="website"> <?php _e("Websites","mystique"); ?> </label><?php endif; ?>
                  <input type="text" name="url" id="field-url" class="textfield clearField" value="<?php if ($comment_author_url) echo $comment_author_url; else  $jquery ? _e("Website","mystique"):null; ?>" size="40" />
    Dave Clements

    (@thewanderingbrit)

    Me too. If a user tabs past the website field (which is empty initially), it puts the word Website in the website field, so when the comment is posted, the URL is set as http://Website.

    Here’s the section of my comments.php with the comment form in it. Any ideas what might be causing it to put the field name in there is it’s tabbed past without entering anything?

    <p class="input">
    				<label for="comment-author">Name</label>
    				<input type="text" name="author" id="comment-author" value="<?php echo '' != esc_attr($comment_author) ? esc_attr($comment_author) : ''; ?>" size="22" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> />
    				<?php if ($req) echo "Name - Required"; ?>
    			</p>
    			<p class="input">
    				<label for="comment-email">E-mail</label>
    				<input type="text" name="email" id="comment-email" value="<?php echo '' != esc_attr($comment_author_email) ? esc_attr($comment_author_email) : ''; ?>" size="22" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> />
    				<?php if ($req) echo "Email - Required"; else echo "Email - Optional"; ?>
    			</p>
    			<p class="input">
    				<label for="comment-url">Website</label>
    				<input type="text" name="url" id="comment-url" value="<?php echo '' != esc_attr($comment_author_url) ? esc_attr($comment_author_url) : ''; ?>" size="22" tabindex="3" />
    				Website - Optional
    			</p>
    			<?php endif; ?>
    			<p>
    				<textarea name="comment" id="comment-comment" cols="22" rows="5" tabindex="4">Message</textarea>
    			</p>
    			<div class="comment-notify-submit">
    				<?php
    					if (function_exists('show_subscription_checkbox')) {
    						show_subscription_checkbox();
    					}
    				?>
    				<p class="comment-submit"><button type="submit" name="submit" value="submit" id="comment-submit" tabindex="5" ><span>Submit</span></button></p>

    have one way, change HTML4 to HTML5 and use placeholder=”website” like this:
    <input placeholder="website" dir="ltr" type="text" />

    I offer you that use below code, it’s complete for comment wordpress:
    <input placeholder="website" dir="ltr" type="text" name="url" id="url" value="<?php echo esc_attr($comment_author_url); ?>" size="22" tabindex="3" />

    example: http://sinac.ws/seo-different-ip/#respond

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Comment form automatically adds website’ is closed to new replies.