Social Networking Top

Phone Mail

  • 0493 24 39 77
  • This email address is being protected from spambots. You need JavaScript enabled to view it.

Language Switcher

ChronoForms V5 - Joomla Registration - External DB

Have you ever needed a registration form for your Joomla website were you needed some information to be stored in an external Database? There is a great solution for this, and it's called ChronoForms.
You can grab a copy of this component here: http://www.chronoengine.com/downloads/chronoforms.html , best thing about it? It's Free.

Now I'm not going to talk about the installation or such of the component, they are enough guides around for that.
But here is a tutorial to create a registration form for Joomla, with some fields were you need the data stored in an external DB.


Go to the backend, ChronoForms component. And Click on the New icon:


Give your form a name and description, make sure setup mode is on advanced



Go to designer, and put some fields. You need at least the same 5 fields for the standard Joomla registration.
3 textboxes, (1 for Name, 1 for username and 1 for Email) and 2 password fields (for password and validation)

Tip: (If you want the user to only register using Username, just create an hidden field instead of textbox for the Name, and put a value in it like "User" or something similar).

Important: If you want to write to an external DB, the "FIELD NAME" for the element must be the same as the Column Name in the table of the external DB. (Unless you are going to edit the code first with a custom code, but lets keep it simple here, shall we ? :))

For the "Verify Password" field, don't forget to set the validation using the "Field ID" of the password field

Now when you have your designer done, like below, go to the Setup page

On load, you need to add the HTML Render form.
On submit add the Joomla registration.
On success add the DB Save
On faill add the event loop, it should look as follow:

Click the edit button on the Joomla registration action, fill in the "Field Name" for each field, which you used on the Designer page

Scroll down, chose the standard group (Most probably Registered) and you want to also set "Send Joomla activation" to yes.
Then save and close.

Go to the DB Save action and click edit, go to external Database tab on top, fill in the information for your db. Then Click on load tables.
If DB is properly set up and user + password grants you access, you will be able to select a table, once done click on Save and Close

Now when the form will be submitted the data for which the "FIELD NAME" correspond to a column in that external DB table, will be filled in.
You can see that for yourself if you add a "Debugger" to the setup. <== Handy for troobleshooting :)

Now, you can go hardcore here, and add a "Custom Code" before your DB action, to manipulate the data before it's save in external DB.
For example, I wanted to have the creation date saved in my external DB. In my external DB table I've a column called "CreationDate".
On the form using the designer, I added a hiddenfield with standard value of 0 and "Field Name" = "CreationDate".

In the custom code I will then use the following

<?php

$form->data['CreationDate'] = date("Y-m-d H:i:s");

?>

Because the custom code is run before the DB save, the value of the CreationDate field will be changed to the date (see php code above).

Great isn't it.. the sky is the limit.. this extension is amazing !

As final, here is the setup of my registration, it might help you, I hope:

PS: don't mind the error "Table Selected" in DB Save, if you use external DB, it just works.

Leave your comments

Post comment as a guest

0

Comments (78)

Load Previous Comments