Magento 1.9 : Validate the Google reCaptcha in custom popupHow to make google reCaptcha mandatory on...

Is there any risk in sharing info about technologies and products we use with a supplier?

Why was Lupin comfortable with saying Voldemort's name?

Using only 1s, make 29 with the minimum number of digits

Why am I able to open Wireshark in macOS without root privileges?

Early credit roll before the end of the film

Do authors have to be politically correct in article-writing?

Numbers with a minus sign in a matrix not aligned with the numbers without minus sign

How should I handle players who ignore the session zero agreement?

What would the chemical name be for C13H8Cl3NO

What is a good reason for every spaceship to carry a weapon on board?

Why is it that Bernie Sanders is always called a "socialist"?

Use two 8s and two 3s to make the number 24

Mathematics and the art of linearizing the circle

Play Zip, Zap, Zop

Is it possible to grant users sftp access without shell access? If yes, how is it implemented?

Why did Democrats in the Senate oppose the Born-Alive Abortion Survivors Protection Act (2019 S.130)?

Quickly creating a sparse array

When can a QA tester start his job?

Positioning node within rectangle Tikz

What's a good word to describe a public place that looks like it wouldn't be rough?

Why would space fleets be aligned?

Why exactly do action photographers need high fps burst cameras?

Consequences of lack of rigour

A curious equality of integrals involving the prime counting function?



Magento 1.9 : Validate the Google reCaptcha in custom popup


How to make google reCaptcha mandatory on contactus pageGoogle Recaptcha Issue on Showing the in Product ReviewHow to Validate the Google reCaptchaGoogle Invisible reCaptcha : bad redirection with AjaxMagento 1.9 : Google reCAPTCHA not letting me create an accountHow to integrate reCAPTCHA v3 in magento 1.9?Installing Google recaptcha:2.0.0 on Magento Open Source 2.2.xIs any way to use Google Invisible reCaptcha in Magento 1.9 admin login?Google recaptcha v2 on Magento 1.9













0















I have added the google recaptcha in custom popup. But, form is also submitting without captcha.



I have used following codes for captcha:



 <script src='https://www.google.com/recaptcha/api.js'></script>
<div class="g-recaptcha" data-sitekey="XXXXXXXXXX"></div>


I have also used js code for validating. But, I think it's not proper way to validate it.



=> js code :



function checkcaptcha() {
if((jQuery('#g-recaptcha-response').val())=='') {
jQuery('.captcha-error').css('display','block');
return false;
} else {
jQuery('.captcha-error').css('display','none');
}

}


Please help me for validating reCaptcha in proper way.



Thanks.



Note : Do not suggest any extension link here. I want to check programmatically.










share|improve this question
















bumped to the homepage by Community 8 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.




















    0















    I have added the google recaptcha in custom popup. But, form is also submitting without captcha.



    I have used following codes for captcha:



     <script src='https://www.google.com/recaptcha/api.js'></script>
    <div class="g-recaptcha" data-sitekey="XXXXXXXXXX"></div>


    I have also used js code for validating. But, I think it's not proper way to validate it.



    => js code :



    function checkcaptcha() {
    if((jQuery('#g-recaptcha-response').val())=='') {
    jQuery('.captcha-error').css('display','block');
    return false;
    } else {
    jQuery('.captcha-error').css('display','none');
    }

    }


    Please help me for validating reCaptcha in proper way.



    Thanks.



    Note : Do not suggest any extension link here. I want to check programmatically.










    share|improve this question
















    bumped to the homepage by Community 8 mins ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


















      0












      0








      0








      I have added the google recaptcha in custom popup. But, form is also submitting without captcha.



      I have used following codes for captcha:



       <script src='https://www.google.com/recaptcha/api.js'></script>
      <div class="g-recaptcha" data-sitekey="XXXXXXXXXX"></div>


      I have also used js code for validating. But, I think it's not proper way to validate it.



      => js code :



      function checkcaptcha() {
      if((jQuery('#g-recaptcha-response').val())=='') {
      jQuery('.captcha-error').css('display','block');
      return false;
      } else {
      jQuery('.captcha-error').css('display','none');
      }

      }


      Please help me for validating reCaptcha in proper way.



      Thanks.



      Note : Do not suggest any extension link here. I want to check programmatically.










      share|improve this question
















      I have added the google recaptcha in custom popup. But, form is also submitting without captcha.



      I have used following codes for captcha:



       <script src='https://www.google.com/recaptcha/api.js'></script>
      <div class="g-recaptcha" data-sitekey="XXXXXXXXXX"></div>


      I have also used js code for validating. But, I think it's not proper way to validate it.



      => js code :



      function checkcaptcha() {
      if((jQuery('#g-recaptcha-response').val())=='') {
      jQuery('.captcha-error').css('display','block');
      return false;
      } else {
      jQuery('.captcha-error').css('display','none');
      }

      }


      Please help me for validating reCaptcha in proper way.



      Thanks.



      Note : Do not suggest any extension link here. I want to check programmatically.







      magento-1.9 captcha






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited May 16 '18 at 5:58







      Rohan Hapani

















      asked May 16 '18 at 5:46









      Rohan HapaniRohan Hapani

      1




      1





      bumped to the homepage by Community 8 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 8 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
























          2 Answers
          2






          active

          oldest

          votes


















          0














          I think you have to try with using google recaptcha div class instead of id in jquery to getting google recaptcha response. I have tried below code and it's working for me:-



          <div class="news-captcha">
          <div class="g-recaptcha" data-sitekey="XXXXXXXXXX"></div>
          </div>


          JS CODE:-



          var googleResponse = jQuery('.news-captcha .g-recaptcha-response').val();
          if (googleResponse!= ""){
          return true;
          }
          else {
          return false;
          }


          After getting response you have to pass this response in input "hidden" field. In the form submit action controller function you can use this hidden field post value and check there that recaptcha response getting or empty response.






          share|improve this answer

































            0














            Please Try with below code :





            <form>
            <script src='https://www.google.com/recaptcha/api.js'></script>
            <div class="g-recaptcha" data-sitekey="XXXXXXXXXX"></div>
            <input type="button" name="submit" value="Sub" onclick="checkcaptcha();">
            <div id="captcha-error"><span></span></div>

            </form>

            <script type="text/javascript">
            function checkcaptcha() {
            var googleResponse = jQuery('.g-recaptcha-response').val();
            if(googleResponse !='') {
            jQuery("#captcha-error span").text("Your text here");
            jQuery('.captcha-error').css('display','block');
            return false;
            }

            }
            </script>





            share|improve this answer























              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "479"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f226169%2fmagento-1-9-validate-the-google-recaptcha-in-custom-popup%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              0














              I think you have to try with using google recaptcha div class instead of id in jquery to getting google recaptcha response. I have tried below code and it's working for me:-



              <div class="news-captcha">
              <div class="g-recaptcha" data-sitekey="XXXXXXXXXX"></div>
              </div>


              JS CODE:-



              var googleResponse = jQuery('.news-captcha .g-recaptcha-response').val();
              if (googleResponse!= ""){
              return true;
              }
              else {
              return false;
              }


              After getting response you have to pass this response in input "hidden" field. In the form submit action controller function you can use this hidden field post value and check there that recaptcha response getting or empty response.






              share|improve this answer






























                0














                I think you have to try with using google recaptcha div class instead of id in jquery to getting google recaptcha response. I have tried below code and it's working for me:-



                <div class="news-captcha">
                <div class="g-recaptcha" data-sitekey="XXXXXXXXXX"></div>
                </div>


                JS CODE:-



                var googleResponse = jQuery('.news-captcha .g-recaptcha-response').val();
                if (googleResponse!= ""){
                return true;
                }
                else {
                return false;
                }


                After getting response you have to pass this response in input "hidden" field. In the form submit action controller function you can use this hidden field post value and check there that recaptcha response getting or empty response.






                share|improve this answer




























                  0












                  0








                  0







                  I think you have to try with using google recaptcha div class instead of id in jquery to getting google recaptcha response. I have tried below code and it's working for me:-



                  <div class="news-captcha">
                  <div class="g-recaptcha" data-sitekey="XXXXXXXXXX"></div>
                  </div>


                  JS CODE:-



                  var googleResponse = jQuery('.news-captcha .g-recaptcha-response').val();
                  if (googleResponse!= ""){
                  return true;
                  }
                  else {
                  return false;
                  }


                  After getting response you have to pass this response in input "hidden" field. In the form submit action controller function you can use this hidden field post value and check there that recaptcha response getting or empty response.






                  share|improve this answer















                  I think you have to try with using google recaptcha div class instead of id in jquery to getting google recaptcha response. I have tried below code and it's working for me:-



                  <div class="news-captcha">
                  <div class="g-recaptcha" data-sitekey="XXXXXXXXXX"></div>
                  </div>


                  JS CODE:-



                  var googleResponse = jQuery('.news-captcha .g-recaptcha-response').val();
                  if (googleResponse!= ""){
                  return true;
                  }
                  else {
                  return false;
                  }


                  After getting response you have to pass this response in input "hidden" field. In the form submit action controller function you can use this hidden field post value and check there that recaptcha response getting or empty response.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited May 16 '18 at 9:43

























                  answered May 16 '18 at 9:22









                  RajRaj

                  311112




                  311112

























                      0














                      Please Try with below code :





                      <form>
                      <script src='https://www.google.com/recaptcha/api.js'></script>
                      <div class="g-recaptcha" data-sitekey="XXXXXXXXXX"></div>
                      <input type="button" name="submit" value="Sub" onclick="checkcaptcha();">
                      <div id="captcha-error"><span></span></div>

                      </form>

                      <script type="text/javascript">
                      function checkcaptcha() {
                      var googleResponse = jQuery('.g-recaptcha-response').val();
                      if(googleResponse !='') {
                      jQuery("#captcha-error span").text("Your text here");
                      jQuery('.captcha-error').css('display','block');
                      return false;
                      }

                      }
                      </script>





                      share|improve this answer




























                        0














                        Please Try with below code :





                        <form>
                        <script src='https://www.google.com/recaptcha/api.js'></script>
                        <div class="g-recaptcha" data-sitekey="XXXXXXXXXX"></div>
                        <input type="button" name="submit" value="Sub" onclick="checkcaptcha();">
                        <div id="captcha-error"><span></span></div>

                        </form>

                        <script type="text/javascript">
                        function checkcaptcha() {
                        var googleResponse = jQuery('.g-recaptcha-response').val();
                        if(googleResponse !='') {
                        jQuery("#captcha-error span").text("Your text here");
                        jQuery('.captcha-error').css('display','block');
                        return false;
                        }

                        }
                        </script>





                        share|improve this answer


























                          0












                          0








                          0







                          Please Try with below code :





                          <form>
                          <script src='https://www.google.com/recaptcha/api.js'></script>
                          <div class="g-recaptcha" data-sitekey="XXXXXXXXXX"></div>
                          <input type="button" name="submit" value="Sub" onclick="checkcaptcha();">
                          <div id="captcha-error"><span></span></div>

                          </form>

                          <script type="text/javascript">
                          function checkcaptcha() {
                          var googleResponse = jQuery('.g-recaptcha-response').val();
                          if(googleResponse !='') {
                          jQuery("#captcha-error span").text("Your text here");
                          jQuery('.captcha-error').css('display','block');
                          return false;
                          }

                          }
                          </script>





                          share|improve this answer













                          Please Try with below code :





                          <form>
                          <script src='https://www.google.com/recaptcha/api.js'></script>
                          <div class="g-recaptcha" data-sitekey="XXXXXXXXXX"></div>
                          <input type="button" name="submit" value="Sub" onclick="checkcaptcha();">
                          <div id="captcha-error"><span></span></div>

                          </form>

                          <script type="text/javascript">
                          function checkcaptcha() {
                          var googleResponse = jQuery('.g-recaptcha-response').val();
                          if(googleResponse !='') {
                          jQuery("#captcha-error span").text("Your text here");
                          jQuery('.captcha-error').css('display','block');
                          return false;
                          }

                          }
                          </script>






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered May 16 '18 at 13:28









                          Ravi OzaRavi Oza

                          1388




                          1388






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Magento Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f226169%2fmagento-1-9-validate-the-google-recaptcha-in-custom-popup%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              “%fieldName is a required field.”, in Magento2 REST API Call for GET Method Type The Next...

                              How to change City field to a dropdown in Checkout step Magento 2Magento 2 : How to change UI field(s)...

                              變成蝙蝠會怎樣? 參考資料 外部連結 导航菜单Thomas Nagel, "What is it like to be a...