Forums

External database saving?

mrea 06 Nov, 2011
Hi Bob
I am trying to switch the DBSave event (in v4) to use an external database, but I keep getting DB query errors.
DO I have to disable the link to use the table I had previously created on the joomla database?
How can I define which form fields match to which database fields? I tried changing the field names to the database names but it still wont create a record?
I guess I may have to use custom code instead or is it possible to edit chronoforms_data or define my own MODEL ID?
CHeers marc.
GreyHead 10 Nov, 2011
Hi Marc,

What errors do you get - that might help pin down the problem. I haven't used the DB Save action with an external database but as far as I know it should connect OK provided that you have all the settings matched up.

Form inputs are matched to database columns by the input and column names - if you want to save the same data in columns with different names then make a second copy in the Form Data array (or use a Model ID).

Bob
mrea 25 Nov, 2011
Thanks Bob
I used some custom code in the end as it would not work 'straight'

For the benefit of others, my method was:

1. Run a custom code module event before show html - this loads the required form data from the database
2. Use php code inside the custom form elements to display the loaded data
3. Run a custom code module event after the validation to save the selected form data to the (external) database

I dont think there is anything in the documentation about ModelIDs - its not obvious how they are used - I think an example here would be great!

Thanks again for a great product - if we go 'commercial' i promise i will pay!
Cheers marc
GreyHead 29 Nov, 2011
Hi Marc,

Thanks for the update.

As far as I an see Model IDs are a way of selecting sub-sets of your form data to be saved. If you define a Model ID of e.g. 'xxxx' for a DB Save action then only data in the $form->data['xxxx'] array will be saved.

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