I'm trying to get the validation status of the Web Captcha on the client side. I have seen examples from infragistics using $IG.WebCaptcha.find('WebCaptcha1'); to get a reference to the Captcha object, but it seems that I am missing the Javascript files that give me access to the $IG.WebCaptcha methods. What do I need to include in my project in order for me to use the $IG functions?
Hello jouin,
Thanks for using Infragistics controls.
The JavaScripts are added automatically. Be sure that you have added WebScriptManager - http://help.infragistics.com/doc/ASPNET?page=WebCaptcha_Getting_Started_with_WebCaptcha.html
Here is an example how to check the validation:
http://help.infragistics.com/doc/ASPNET?page=WebCaptcha_Captcha_Validation.html
Best Regards,
I have the following code:
<form runat="server">
<ig:WebScriptManager runat="server" ID="WebScriptManager1" />
<ig:WebCaptcha runat="server" ID="WebCaptcha1" CaptchaImageSettings-TextLength="3" InputValueEditor-ReadOnly="false" SubmitButton-Enabled="false" SubmitButton Visible="false" />
</form>
__________________________________________________
and my javascript code:
// check to see if the captcha is valid function validateCaptcha(captchaID) { var captchaIsValid = false;
var captcha = $IG.WebCaptcha.find(captchaID); // gets a reference to the WebCaptcha control
if (captcha.get_validationFailed()) // checks if the validation was successful on the server { alert("captcha is not valid!"); } else { alert("captcha is valid!");
captchaIsValid = true; }
return captchaIsValid; }
Any time I call validateCaptcha("<%=WebCaptcha1.ClientID%>") I get the following error message in the Google Chrome debugging console:
Uncaught TypeError: $IG.WebCaptcha.find is not a function
If I set the WebCaptcha to have Visible="false" then the error message changes to this:
Uncaught ReferenceError: $IG is not defined
Sorry for not mentioning this earlier, but I am using version 15.1
Could you try to get the control reference in this way - ig_controls.WebCaptcha1?
I tried both of these:
var captcha = ig_controls.WebCaptcha1;
and
var captcha = ig_controls.<%=WebCaptcha1.ClientID%>;
They both return "undefined"
Would you send a sample application?
Thanks in advance!
Regards,
Hello,
I'm just following up to see if you need any further assistance with this issue. If so please let me know.