I made a Joomla registration form with ChronoForms and have a problem.π
If entering a username that already exists, Joomla rejects it but ChronoForms sends an email as if the registration was successful.
How do I validate if entered items already exist or not before sending email ?π€¨
Hi Tomophy,
set the plugin to work "before email", this is in the Plugin config page!
now, in your onsubmit before email code, use this code:
<?php
$MyForm =& CFChronoForm::getInstance();
$MyPlugins =& CFPlugins::getInstance($MyForm->formrow->id);
if($MyPlugins->cf_joomla_registration['errors']){
$MyForm->stoprunning = true;
$MyForm->formerrors = $MyPlugins->cf_joomla_registration['errors'];
$MyForm->showForm($MyForm->formrow->name, $posted);
}
?>
this will work ONLY with V3.1 RC4 or above!
cheers
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Hi Max,
Thanks for your reply.
I don't find "before email" in the Plug-in config page in ChronoForms V3.1 RC4 . :?
Hi tomophy,
I think this is the setting Max means.
Bob
Hi Bob,
I got it π€
Thank you for your advice.π
I'm having this problem too, but the solution isn't working for meπ
I've got my custom rego form working for new registrations, it even auto-login's and kicks the user to the right restricted page as long as the username isn't already in use.
If the username is in use, it still acts like it works except it doesnt autologin (for obvious reasons) OR if I have the redirect url blank, it just displays a blank screen. I've tried adding the PHP code from the above posts to the server side validation as well as the form AND plugin 'before submit' code textboxes and it doesn't seem to be working. I'm running 3.1RC5 btw.
If I run the form in debug mode it says everything checks out OK, even though I know the username is in use.
EDIT: Okay I've figured it out, I need to have an email set up and have the form send an email for the fix above to work. If you don't have the form sending an email on submission, it appears that the username in use validation doesn't run or doesn't return the right result.
Hi kythin,
That makes sense - the OnSubmit Before code only runs if email is enabled. OnSubmit After will always run.
Bob
Hi ranail,
Where are you running this code?
$post is used internally by ChronoForms to hold the $_POST array values. It should be available to you, but it will depend on where you run the code.
Bob
On Submit code - before sending email:
I tried $posted as Max listed then tried $post not know which might be available.
Both did not work.
I upgraded to the new 5.1 and It has some options to "Try to publish" available fields.
And it comes up with username and password on initial entry but nothing for failed save when dups are found for email or username.
thanks,
Rusty
Hi ranail,
I'm not quite sure what you are doing here.
If you want to add server-side validation for these fields then you can add some code in the Server-side validation box on the Validation tab and enable the validation there. This should re-display the form with the current values.
I don't see that Max's code is useful or helpful here.
Bob
PS For the validations you list - using ChronoForms built-in client side validation is probably easier.
Hi ranail,
the code below works fine when I have republish enabled in a new form with one field only in RC5.1
<?php
$MyForm =& CFChronoForm::getInstance();
$MyPlugins =& CFPlugins::getInstance($MyForm->formrow->id);
if(1){
$MyForm->stoprunning = true;
$MyForm->formerrors = 'ddddd';
}
?>
Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Hi ,
I also have the same problem and I tested it serval times. I read the instructions of max and did what I need to do. But the problem didn't solved.
So when I register by the site and use the same username and email after push the button to register I don't getting errors that the email and username is already existing. I get the redirect to my thank you page. I get the mail that is installed and enable by chronoforms, but no email from the joomla registration.
I don't know where the problem is ?
Thanks to help guys,
Kris
Hi vdlkris,
In the last few days there has been another thread here where I published a beta version of the Joomla Registration Plugin with more features that handles some of these problems.
Bob
Hi Kris,
Please show me a screenshot for the code used at your onSubmit box and make sure you have RC5.1
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.