So I am trying to prevent the comment form message box from clearing when a user enters the wrong CAPTCHA and the screen requires them to back-click. Obviously, it is poor usability if the visitor has entered a long comment, types in the wrong CAPTCHA, and their message clears. And before I get advice on getting rid of the CAPTCHA, I have read all the arguments against CAPTCHAs, but I still need to use one per my manager’s request.
I have determined that the message clears, but not the author, email, or subject, because the <textarea> tag does not have a value associated with it. WordPress seems to have value variables for the other three inputs, but nothing for the textarea tag. I read that it would be possible to put the value between the opening and closing textarea tags and I think this can be accomplished with <?php if(!empty($_SESSION['comment']))echo$_SESSION['comment']; ?>">. My problem is that somewhere I need to declare the session_start() and presumably this would occur in the comment.php WordPress include. I know enough PHP to get around, but hacking into plugins/modules is not my strong suite. I was wondering if anyone had advice towards accomplishing this and/or where to start the session so that I can prevent the comment textarea from clearing.
Thank you in advance,
Klara
The topic ‘Prevent comment textarea from clearing upon failed CAPTCHA’ is closed to new replies.
(@klara-webdev)
12 years, 6 months ago
So I am trying to prevent the comment form message box from clearing when a user enters the wrong CAPTCHA and the screen requires them to back-click. Obviously, it is poor usability if the visitor has entered a long comment, types in the wrong CAPTCHA, and their message clears. And before I get advice on getting rid of the CAPTCHA, I have read all the arguments against CAPTCHAs, but I still need to use one per my manager’s request.
I have determined that the message clears, but not the author, email, or subject, because the
<textarea>
tag does not have a value associated with it. WordPress seems to have value variables for the other three inputs, but nothing for the textarea tag. I read that it would be possible to put the value between the opening and closing textarea tags and I think this can be accomplished with<?php if(!empty($_SESSION['comment']))echo$_SESSION['comment']; ?>">
. My problem is that somewhere I need to declare the session_start() and presumably this would occur in the comment.php WordPress include. I know enough PHP to get around, but hacking into plugins/modules is not my strong suite. I was wondering if anyone had advice towards accomplishing this and/or where to start the session so that I can prevent the comment textarea from clearing.Thank you in advance,
Klara