Forums

Captcha Reload Suggestion

johnnyl 30 Mar, 2008
Currently the captcha will default to a reload of the Chrono form if the captcha is typed incorrectly, rather than reload the full page the form was actually on.

ie: the reload will take it to here:
domain.com/index.php?option=com_chronocontact&task=send&chronoformname=form_name

rather than the SEF URL originating page here:

domain.com/form_submit

A suggestion would be an option in the backend to specify a URL to redirect to on a captcha reload, rather than just reloading the Chronoform itself and not the original page the form was on.

Benefits to including this option in the backend would be:
1) Prettier URL redirect
2) Original page is re-rendered on reload instead of going to a form only page.

Love your Chronoform plugin!

Thanks,

Johnny<br><br>Post edited by: johnnyl, at: 2008/03/30 19:33
jxl 31 Mar, 2008
Hi Johnnyl,
Personally i'd like to see the opposite approach, where only the captcha field is reloaded, or even, an error message comes up without any reloading at all. That way visitors would not lose all data they already entered into the fields.
johnnyl 31 Mar, 2008
Ooh.. That's a good idea too. A simple reload of the captcha only or an error message only would be good...

j
Max_admin 31 Mar, 2008
Hi All,

Good suggestion but will need AJAX, and the worst issue of AJAX is that if your page has a JS error then it will not work fine, but a really cool idea and we may get it implemented and leave it optional!

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
leolll 08 Jun, 2009
It seems that johnnyl's suggestion is now the standard way captcha errors are handled. Personally this approach doesn't work because I have long articles with a form at the end. Upon making a captcha error the article reloads but the error message is at the bottom of the page. Most users will not know about the error.

Perhaps an anchor link could fix this?

Or code I change the code to revert back to the old approach?
GreyHead 08 Jun, 2009
Hi leoll,

This is a very old thread.

The standard ChronoForms Captcha shows an error message at the top of the form.

You proably need to hack the code to show the message as a system message which will appear at the top of the page. ChronoForms doesn't do this because because many templates don't seem to show system messages correctly.

Open com_chronocontact/libraries/chronoform.php and at line 257 add a few lines
		if($MyForm->formerrors){
		    foreach ($MyForm->formerrors as $message  ) { // <-- add this
		        $mainframe->enqueuemessage($message, 'error');  // <-- and this
		    }  // <-- and this
			if($session->get('cfreturnurl_'.$formname, '', md5('chrono'))){
Not tested and may need debugging

Bob
leolll 09 Jun, 2009
Thanks for the quick reply Bob. Is it possible to load a page showing just the form and error message? Otherwise the error will be at the top of the page but the form will be all the way at the bottom of the page.

Loading a page with just the error and the form was used in ChronoForms V3.0 Stable.
GreyHead 09 Jun, 2009
Hi leoll,

Not without hacking the code - Max changed the error message process in the later releases so that it doesn't use the Joomla System messages (because they were not being reliably displayed in all templates).

I think that the hack would be to find these lines around line 125 of chronocontact.html.php
		<?php if($MyForm->formerrors){ ?>
            <span class="cf_alert"><?php echo '<ol>'.$MyForm->formerrors.'</ol>'; ?></span>
		<?php } ?>
and replace them with
		<?php if($MyForm->formerrors){
            foreach ( $MyForm->formerrors as $error ) {
                $mainframe->enqueuemessage($error, 'error');
            }
		} ?>

Bob
leolll 09 Jun, 2009
Inside chronoform.php I commented out line 229 and got the effect I was looking for (see image below)

So now an incorrect captcha will load the form by itself with the error on top.

Thanks for the rapid support Bob!
newstuff 28 Sep, 2009
leoll, your solution was perfect. I just updated chronoform.php - it was on line number 277 (just upgraded to latest version tonight). I too have long articles, and it was difficult to view the results of whether the form submission was correct or not - most people would have navigated from the page and perhaps not think to scroll down to the bottom of the page to check...

Joomla 1.5
ChronoContact 3.1RC5.5
webcaju 16 Aug, 2013

Inside chronoform.php I commented out line 229 and got the effect I was looking for (see image below)

So now an incorrect captcha will load the form by itself with the error on top.

Thanks for the rapid support Bob!



Hello to all,

I'm using version 4.0 RC3.21 and found the file to edit these lines that leolll said, someone could lend a hand.

Thank you ...
GreyHead 16 Aug, 2013
HI webcaju,

This is an old thread for a earlier version of ChronoForms. What is it that you need to do?

Bob
webcaju 19 Aug, 2013
Hi Bob,

I need to click the submit with the value of the captcha wrong that had not the exchange page but an error message as if it were a required field that appears just below the message field and the message above.

Is this possible? Today have a fomulário in a lightbox (fancybox) and if the captcha is wrong the lightbox (fancybox) closes and when it opens again appears that the form was not submitted.

Thank you ...
webcaju 28 Aug, 2013
Hello Bob,

So I found the file check_captcha.php and saw that already exists error messages if the captcha field is not filled in, I realized that if the code is filled wrong instead of using the same form of error message it has to pass through "event=submit"

I wonder if this check_captcha.php file or other file you can take this "event=submit" and leave only the check as if the field was not being filled.

Thank you ...
GreyHead 02 Sep, 2013
Hi webcaju,

I'm sorry I still don't really understand how you want this to work. The Anti-spam actions like Captcha all require the form to be submitted because the tests are run on the server, not on the browser.

Bob
selinaltinok 04 Sep, 2013
So could we use ReCaptcha with the component?
GreyHead 04 Sep, 2013
Hi selinaltinok,

Yes.

Bob
This topic is locked and no more replies can be posted.