Forums

Captcha error messages

Huski 23 Apr, 2012
Hi
Have set up new form with V4 on Joomla 2.5 - starting to get my head around it after converting from J 1.5.

I have a long form with the core captcha at the end. If the wrong verification code is entered, the core error message appears at the captcha element itself, but the user is taken back to the top of the form and they have no idea other than to scroll down that there is an error. There is no system error message like in the video tutorial.
How do I force it to scroll back down to captcha element?
Cheers
Huski 07 May, 2012
Anyone able to help on this?
Qbik 19 May, 2012
I have the same problem, anyone can help?
GreyHead 19 May, 2012
Hi Qbik & Huski,

Here's a script snippet that should do this:
window.addEvent('domready', function() {
    var errors, p, inputs;
    errors = $$('div.error-message');
    if ( errors.length > 0 ) {
        p = errors[0].getParent();
        inputs = $$(p.getElementsByTagName('input', 'select', 'textarea'));
        inputs[0].focus();
    }
});
It will check for error messages and try to focus on the input matching the first message it finds (which may not always be the first error in the form).

Bob
Huski 19 Jun, 2012
Hi greyhead
Where do I put that snippet of code?

One other quick question - in the Joomla 1.5 version you could set the width or size of input fields. I can't find this anywhere in the new chrono version for Joomla 2.5

Huski
GreyHead 19 Jun, 2012
Hi Huski,

It's JavaScript so needs to go into a Load JS action in the On Load event.

You can set the Field Max Length and Field Size in the element General tab for most elements. But it's probably simpler to make the change with CSS in a Load CSS action in the On Load event as a few rules there will apply to all elements.

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