Validation and/or captcha redirection messes up everything!

priestjim 11 Oct, 2008
Hi!

First of all congrats on your great work, it really is the most complete and functioning solution on forms in Joomla. Now to the issue.

Well the problem is pretty simple: I create a form, put everything I want in it, publish it. If I submit the form with wrong server-side validation data or with a wrong captcha, it takes me to a new url (apparently) that not only contains the form only (with any data from the page the mambot was called or any module I have specifically enabled for the form disappeared)! The problem is it is very ugly and counterintuitive because it removes everything explicitly added to the form page!

One suggestion would be to use POST to do any form validation in order for the url not to change.

Thouhts?

Edit: Forgot to mention, CF 3.0 final.
GreyHead 11 Oct, 2008
Hi priestjim,

This certainly was a problem with some versions of ChronoForms, I'm not sure if it's been completely fixed in CF 3.0 (as I recall there are problems in returning the correct page link from a plugin) but server side validation is available if you are prepared to code it yourself. Scroll down in the validation tab and you'll find it.

Later: There's also a 'Try to rebublish' option in the AntiSpam tab where C will do it's best to preserve and republish data automatically. You may need to tweak the code by hand for more compex forms.

Bob
priestjim 11 Oct, 2008
Hi and thanks for the quick reply.

The problem is that even a complete CF page (through a CF menu item) suffers from the same issue (no modules in validation failure, no page title and of course no SEF items-description, keywords etc).

In addition, the "Try to republish" has no effect here because there is no actual problem in republishing the data of the form (the data is republished correctly) but rendering the complete Joomla page correctly (with modules and stuff).
Max_admin 12 Oct, 2008
Hi priestjim,

The attached patch should fix this issue!

Regards,

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
priestjim 12 Oct, 2008
Unfortunately, it did not solve any problem.

1. Now when I submit the form with fields that do not validate, I get the error message normaly. But when I revisit the original form to enter some other test data, I get the normal form plus the div with the validation error message I got previously. The error message dissappears when I delete the site cookies.
2. If you wan to see what I am actually talking about check this form out: http://www.enak.gr/site/contactus.html (it's in Greek). Press the lower left button (that's submit) without entering any data. You'll get the bare form with no modules, no text and the validation message. Plus when you revisit the page you'll get again the same validation error message you got before!
3. On a totally different question, how can I change some post variables after the form has been submitted (J1.5) ? I tried


$name = trim(JRequest::getVar('name'));
if ($name == "") $name = " ";
JRequest::setVar('name',$name);


on the Onsubmit before e-mail but it does not work!!

Thanks!
GreyHead 12 Oct, 2008
Hi priestjim,

I'll leave the validation stuff to Max for the moment. I think the coding can be simpler.
<?php
JRequest::setVar('name', '', 'post', false);
/>
where the parameters are: 'field_name', 'default_value', 'request_hash', 'override_if set'. So this should set the value of $_POST['name'] to '' if it's not set

You don't need the trim as Joomla should trim and clean when CF uses getVar later.

Bob
priestjim 12 Oct, 2008
OK the craziest thing happens. I can modify the value of a hidden input with setVar but anything else stays the same even if I modify it!
GreyHead 12 Oct, 2008
Hi priestjim,

Then something else is going on . . . Joomla can't tell the difference. Try putting
<?php
echo "POST: ".print_r($_POST, true)."<br /><br />";
?>
before and after the setVar and see what's happening with it.

Bob
Max_admin 12 Oct, 2008
Hi,

attached a fix for the validation issue, this problem is not related to the fix I made earlier.

the fix I made earlier was this, when I set module "latest news" for example to be shown in the form menu page, and then I open this page, I can see the module there, but when the form is submitted or wrong captcha is added and page reloaded, the module goes away, that's because the Itemid was not resent, that's what I fixed the first time, is this what you was looking for initially ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
priestjim 13 Oct, 2008
So after fiddling a lot trying to make the forms work the way I wanted, I sat down and wrote (both of) them by hand. Thanks for all the help nonethelessđŸ™‚

Cheers!
Max_admin 13 Oct, 2008
Ok no problems, we got an issue fixed anyway!đŸ™‚

Cheers,

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger