Forums

Create and Edit user information in db

interactie 10 Oct, 2015
Hello,

I would like to achieve the following:
[list=]First form: Create a new User Account and save submitted data (address, telephone... for example) in database.[/list]
[list=]2nd form: This is a copy of the first form and is only visible for logged in users. The form shows all the data the logged in user submitted before (first form) in the db. The user is able to change the previously added data and update this in the same database.[/list]

I have created the first form succesfully. The only strange thing is that the column user_id (generated automatically by CF) is blank after saving. The columns id, uniq_id and created are saved successfully. I think this is important.

To create the second form, I copied the first form and made some changes. I spend a lot of time configurating the DB Read option. I don't know what else to do to show the user data... Is DB Read the right option?

Who can help me solving this?
Thank you in advance,
Niels
GreyHead 10 Oct, 2015
Hi Niels,

ChronoForms can only save the user ID if the user is logged in, your newly created user probably isn't logged in so the user_id column is empty.,

The user ID is available after the Joomla! Registration action has run, add a Debugger action temporarily to see the exact name in the $form->data[''] array, then use a Custom Code action to copy that into $form->data['user_id'] - I think that will do what you need to make the data findable.

Then the DB Read should just use a Condition that looks for the current user's ID - the link from Prof Calculus should help there.

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