Forums

Forms in modules and component space

quayfee 27 Oct, 2011
Hi,

I'm having trouble with a page that has 3 CF forms, one in the main component space, two in modules.

The issue arrrises with error handling. Starting with the main (component) form, I've added captcha (core) which works fine if I unpublish the other forms. However when another form in a module is present, if the user enters the incorrect data into the captcha field, rather than showing the error messages (as it does without the form present), it submits the next form in order, thus sending a blank email with the unedited template and redirecting the user to an incorrect page.

The second issue that I'm having is that core captcha doesn't appear to work in the module, instead you get {chronocaptcha_img} displayed, which looks to me like a plugin is not being activated in the module.

I have a feeling that these are configuration issues, something that I've missed. ANy help would be greatfully received.

Thanks

Keith
Joomla 1.7 / CF 4
Uclabruins 29 Oct, 2011
Well i think the quickest fix would probably be to make sure none of the fields in those three forms have the same name. At least, thats where id start the troubleshooting process. If you need them to have the same name, the fix is probably a little more complicated (if the problem is in fact duplicated field names). The problem may just be that the submit buttons have the same name.

Also, this isn't really related to your question, but regarding the captcha, unless you absolutely need it, you may want to consider doing away with it. Captcha is probably one of the most irritating things to see as a user of a site. Even savvy people who understand the reason for captcha hate to try to get that code right. In fact I've navigated away from sites because of the captcha. Just my 2 cents
GreyHead 30 Oct, 2011
Hi quayfee,

The scripts used for validation will use the input names (or ids) as identifiers. As Uclabruins says you need to ensure that they are all unique.

Bob
quayfee 30 Oct, 2011
Hi Guys,

Thanks for your replies.

The forms do each have different Ids and names for the fields. Each form works fine (apart from capths never being discplayed in the modules), the issue only arises if, in the main form (component) has an incorrect value entered into the captcha field. the onfailure event sends the user back through the event loop. Is it that I need to add a stop to the end of thte on Submit event to prevent it looping into the other forms' on Submit?

With regard to the captcha not showing in the modules, this happens even if the form in a module is the only form on a page. Is this a code snippet that's not being run when a form is in a module?

I'd love not to use captcha at all, but this particular site gets a significant amount of form SPAM so we're trying to go some way to preventing it. DO you have any other suggestions?

Cheers

Keith
GreyHead 31 Oct, 2011
Hi quayfee,

I think I can see more or less what is happening here but I'd have to dig into the code to see why the error messages on the other forms are being triggered.

It might be simpler to use a form-based captcha - a checkbox that needs to be checked, or a simple sum and then validate that using server-side validation.

Bob
quayfee 18 Nov, 2011
Hi Bob,

That sounds in interesting idea. I've seen on a site somewhere a js slider (I think that particular one was jQuery) that had to be activated before a form could be submitted. Far less obtrusive than full-on capture.

I'll have a play with this idea. I've not used server side validation (that I'm aware of :o) ) so that's something new to figure out!

Cheers

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