Forums

Joomla 2.5 - Chronoform V4 - DB SAVE doesn't save on another table

mailjoss 15 Mar, 2014
Hi
My purpose is to ask for informations to the visitor who want to become member.
Then the informations are listed, and when the paiement is verified, we put the informations in our "member" table, adding few data.
And then this member list is used for our activity (liste, update).

So I have a form 'inscription" wich create the data in "inscription" table, it runs well.
I have a chonoconnectivity to see the list of data of "inscription table", it runs well.
This list sends to another form "validate", wich is populated by the "inscription" table. It runs fine.
This form have to create a new row into our "member" table with the data in the form.
So I have a DB SAVE with the "member table", but it is not well update. Here is the issue.

(The "inscription" is always update, without need the DB SAVE)

1st sample : if cf_id of "inscription" table is "72" and if there is an ci_id=72 in "member" table, then the "member" table is updated. That the error I tried to solve by changing the cf_id autoincrement of the "inscription" table.
2nd sample : if cf_id of "inscription" is "300" and there is no cf_id="300" in "member" table, the new record is not created in the "member" table.

How to solve that, in order the new row in "member" table to be created ?

Greeting

Jocelyn
mailjoss 15 Mar, 2014
Here is the debug trace, it should be INSERT and not UPDATE I think :
UPDATE `j25_bottin`
SET `Bot_Nom`='tes-301',`...'
WHERE `cf_id`='301'

How to code INSERT and not UPDATE ?
mailjoss 15 Mar, 2014
I changed the name of the cf_id to cf_id1 in the "inscription" table, and the the INSERT is well generated for the "member" table.
It seems to be good for me, but I accept an explanation in order to make better for the others forms.
GreyHead 16 Mar, 2014
HI Jocelyn,

I don't fully understand what you need here. But the Joomla! code that ChronoForms uses is straightforward.

The table much have a numeric primary key; if there is a primary key value in the form data and it already exists in the table then update the record; otherwise, insert a new record.

You can use PHP in a Custom Code action before the DB Save action to rename form inputs or unset them if you need this to get your logic to work.

Bob
mailjoss 16 Mar, 2014
Hi Bob
thanks for the answer
My issue was because I read a table and write into another, and the keys had the same name (created automaticaly).
The change of key name was enough to solve.
Greetings

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