Input form placement & captcha

Phoca Guestbook - creating guestbooks in Joomla! CMS
bjamieson
Phoca Newbie
Phoca Newbie
Posts: 7
Joined: 16 Nov 2008, 01:44

Input form placement & captcha

Post by bjamieson »

Hi,

I am using the guestbook, and found it easy to install and configure - so major congratulations.

There is one improvement I would like to suggest, and that is how the form reloads when everything has been filled in correctly, except for the Captcha code.

When you make an error in the code, you get returned to the top of the page - but it is not apparent that the code was wrong.

It would be great if the form could be reloaded and it 'jumps' to the form so that you can see that you did not fill the captcha code in correctly. Could this be done using html anchor links that anchor to the form, and not the top of the page ?

best regards,

Brian
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48689
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Input form placement & captcha

Post by Jan »

Hi, if you type wrong captcha, the site will be redirect to the same form with all filled information and with the red message that the filled captcha was wrong ...
If you find Phoca extensions useful, please support the project
bjamieson
Phoca Newbie
Phoca Newbie
Posts: 7
Joined: 16 Nov 2008, 01:44

Re: Input form placement & captcha

Post by bjamieson »

Jan wrote:Hi, if you type wrong captcha, the site will be redirect to the same form with all filled information and with the red message that the filled captcha was wrong ...
Yup, you are right, but the only thing is, that you are returned to the top of the page. And the form (with the red error message "The Captcha code you have entered is wrong. Please, try it again") is at the bottom - that is where I want to place my form.

The problem is that a lot of people would not realise that they had not submitted their guestbook entry correctly, and might click on the menu to go elsewhere. Does that make sense ?

cheers
bjamieson
Phoca Newbie
Phoca Newbie
Posts: 7
Joined: 16 Nov 2008, 01:44

Re: Input form placement & captcha

Post by bjamieson »

Here is an example of what I mean :

On the site I look at the guestbook - but the 'form' is located at the bottom of the page.

Image

I scroll down to fill in my entry - everything is right except the captcha code, and I hit submit.

Image

The 'form' is reloaded - but I am at the top of the page - there is not indication of an error.

Image

I need to scroll down the page to see that I did not put the code in correctly.

Image

What would be better would be if there was an anchor to the 'form' so that when it reloads, it goes straight to the 'error' anchor and the user can see exactly what has happened.

Does that make sense ?

cheers,

Brian
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48689
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Input form placement & captcha

Post by Jan »

Yes, I understand you, this need to be custom made, e.g. if you know that you have the form in the bottom of the page, you should place the messages somewhere into the top but as I say it need to be custom made...

components\com_phocaguestbook\views\phocaguestbook\tmpl\default.php

// Server side checking CAPTCHA
if ($this->captcha_msg)
{
echo '<small style="color:#fc0000;">'.JText::_( 'Phoca Guestbook Wrong Captcha' ).'</small><br />';
}
//-- Server side checking CAPTCHA

somwhere into the top...

Jan
If you find Phoca extensions useful, please support the project
bjamieson
Phoca Newbie
Phoca Newbie
Posts: 7
Joined: 16 Nov 2008, 01:44

Re: Input form placement & captcha

Post by bjamieson »

Hi Jan,

I settled on the following changes :

1) Create an anchor point at the start of the form:

<a name="captchaerror"></a>
<form
action="<?php echo $this->action; ?>"
method="post" name="saveForm" id="pgbSaveForm" onsubmit="return submitbutton();">

2) I'm not a php guru (or beginner for that matter ;-) )
So I added some javascript - I'm sure that there must be a MUCH better way to achieve this - but it works for me...

<script language="javascript" type="text/javascript">
function jumpToError(){
var captchaerr = "FALSE";
captchaerr = "<?php if($this->captcha_msg) echo 'TRUE' ?>"
if (captchaerr=="TRUE") setTimeout("location.href='<?php echo $this->action."#captchaerror" ?>'", 0);
}
jumpToError();
</script>


So it is a bit cheeky...
It sets the jump point, and if there is a captcha error, it does an immediate redirection to the anchor point. This MIGHT cause the form to be reloaded twice - but in testing it, I have seen no problems.

cheers,

Brian
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48689
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Input form placement & captcha

Post by Jan »

ok, thank for this solution, please let me know the site with this solution...

Jan
If you find Phoca extensions useful, please support the project
bjamieson
Phoca Newbie
Phoca Newbie
Posts: 7
Joined: 16 Nov 2008, 01:44

Re: Input form placement & captcha

Post by bjamieson »

It's not live yet - but I will let you know - the hope is it's live for the new year...

cheers,

Brian
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48689
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Input form placement & captcha

Post by Jan »

ok
If you find Phoca extensions useful, please support the project
bjamieson
Phoca Newbie
Phoca Newbie
Posts: 7
Joined: 16 Nov 2008, 01:44

Re: Input form placement & captcha

Post by bjamieson »

Hi Jan,

I said I would get back to you...

Currently the site is working @ the following temporary url.

But I thought you might like to see the functionality in operation...

http://bnj.homelinux.net:8080/joomla

Cheers, and happy christmas.

Brian
Post Reply