Hi,
I wanted to hide the submit button until a valid recaptcha response is returned.
Otherwise a user may get a cryptic āMISSING-INPUT-RESPONSEā error message, if the submit button is clicked before clicking āIām not a robotā.
This is what I did:
added the data-callback function in admin/plugins/RecaptchaPlugin.php:
added id=āsubmitā to submit buttons in index.php in functions
preferencesPage
subscribePage
added some Javascript into public footer in Settings->Subscribe pages (for some reason I couldnāt get jQuery to work) as follows:
ā¦
</div><!-- ENDOF #container -->
<script type=ātext/javascriptā>
document.getElementById(āsubmitā).style.visibility = āhiddenā;
</script>
<script>function recaptchaCallBack() {
document.getElementById(āsubmitā).style.visibility = āvisibleā;
}
</script>
ā¦
I hope all the tags are correct. I didnāt first realize that I have to use the html entity notation.
Now the submit button is hidden until a valid Recaptcha response is received.
Perhaps this feature can be added in a future release of phpList and Recaptcha pluging.
@veltsu The āproblemā here is simply that the plugin does not validate that the recaptcha has been completed before sending the validation request to google. I can fix that so a meaningful error message is displayed.
Iām also looking at the client-side validation so that not completing the recaptcha gives a pop-up similar to how core phplist reports a missing email address, etc. All this can be done by the plugin without any changes to phplist files.
Hi,
how to translate the texts introduced by the latest update?
There seems to be no standard for plugin translations.
There are translatable texts in so many places. I would like to keep the admin side in English (easier for support) and translate everything in front-end to Finnish. Most of the texts are in finnish.inc, but not all.
But will need to update the plugin first. Front-end texts did not work as I expected so have had to include a workaround, but that seems to work in my simple test of a different language.
I updated the plugin. Itās now 1.4.1+20180522.
I created translations_fi.php, but I do not see my translations. They are not in the db. I only need to translate the front-end texts. My back-end is and will be in English (to get support more easily). That might be the reason after a quick look at the logout function in CommonPlugin.php.
@veltsu You will have to switch the admin language temporarily to Finnish, then log out. That should update the translations, then you can login again and switch the admin language back to English.
There is one minor problem:
If a user clicks the submit button without validating reCAPTCHA, the correct message āPlease complete the reCAPTCHAā is displayed. On the next time without validating reCAPTCHA, the āPlease enter you Emailā is displayed.
It looks like the client-side validation does not work. I did not realize, that the form is submitted even if the reCAPTCHA is not validated. In this case the email value will be a placeholder, not a value.
Please consider using the data-callback function.
@veltsu The escaping of double quotes should have been handled by the plugin.
But I have revised the approach to hold the frontend translations in a separate file to the admin translations to avoid the workaround that I had coded. Now the pluginās frontend texts are translated directly from a frontend_xxx.php file, whereas the admin translations are added to the I18N table in the database.
You will need to upgrade the Recaptcha plugin and Common Plugin.