This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.
Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.
Before posting questions here you might want to review the developer documentation.
Hi,
Im just trying to use a Captcha on a custom module for the first time. The form is on a supporting page and after I submit the form I validate the page using Page.Validate() and then check if(page.Isvalid) do something.
However the problem I am having is regardless of what is entered for the Captcha, Page.Validate always returns true. I have configured the captcha as shown in the vid but must be missing something as the captcha obviously isn't been validated with the page.
Captcha control on .aspx page
<mp:CaptchaControl ID="captcha" runat="server" />
Captcha set up in load settings
captcha.ProviderName = siteSettings.CaptchaProvider; captcha.Captcha.ControlID = "captcha" + moduleId.ToInvariantString(); captcha.RecaptchaPrivateKey = siteSettings.RecaptchaPrivateKey; captcha.RecaptchaPublicKey = siteSettings.RecaptchaPublicKey;
Button click event
protected void btnSubmitReview_Click(object sender, EventArgs e) { Page.Validate(); if (!Page.IsValid) { return; }//Never returns here as page.IsValid is always true .
. WebUtils.SetupRedirect(this, Request.RawUrl); }
Any help would be greatly appreciated
I would initialize the captcha settings from the OnInit event instead of page load (or call your LoadSettings from OnInit instead of page load).
If Page.IsValid is always returning true I would check also if(captcha.IsValid)
Hope that helps,
Joe
Thanks a mil for the quick response Joe. Initializing the settings for captcha in Onit worked a treat. Seems like the obvious thing to try now that its been pointed out to me but had stepped thru it a few times and hadn't spotted that. Suppose its easy when u know how. Thanks again Joe. U saved me a lot of time and heart ache.
Starting to get to grips with mojoportal now and I have to say congrats its a great product.