Quantcast
Channel: C1 CMS Foundation - Open Source on .NET
Viewing all articles
Browse latest Browse all 2540

New Post: Using Captcha in XSLT function‏

$
0
0
Hello there,

In my website viz made in CMS (C1 Composite version 3.2.4681.14221 ), I am using the c1 Captcha in the my form and I need to access the function ("captcha:IsValid($captcha_value, $captcha_encryptedValue) ") in the jquery function on button click to validate my captcha value.

I have looked into the code given at http://docs.composite.net/Functions/XSLT/Captcha-in-forms but it wasn't helpful in my case of validating the captcha.

I am using following way to access the value of Cpatcha:IsValid() function :
<script>
$(document).ready(function() {
    $('#button').click(function()
     {  
        <xsl:variable name="isValidCaptcha" select="captcha:IsValid($captcha_value, $captcha_encryptedValue)" />                                    
          var result = $('<xsl:value-of select="$isValidCaptcha" />').selector;
          if(result == 'true')  
             return true;
         $('#txtCaptcha').addClass("error");    
          return false;
     });
});
</script>
where
$captcha_value = <input name="captcha" type="hidden" id="captchaEncryptedValue" value="{$captcha_encryptedValue}" />

and

$captcha_encryptedValue = <input type="text" Placeholder="Type above text" id="txtCaptcha" name="txtCaptcha" value="{$captcha_value}" />

When I run this webpage the value of "var result" is set to false which is correct as by default while loading page value of captcha_encryptedValue is blank . but when after posting the form with correct captcha value still value of result remains false.


Can you please let me know whether we can get the value of "captcha:IsValid($captcha_value, $captcha_encryptedValue)" on runtime in jquery function. if yes how can we achieve that.

Hoping for your help.

Viewing all articles
Browse latest Browse all 2540

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>