Forums

Is there a way to edit data already submitted via the form?

garmungo 17 Jul, 2010
This component is great. Right now it allows my users to submit information about various things. Chronoforms then automatically stores this information in a database.

My question is this--Let's say one of my users submits some info, then decides they want to go back and update a few of the information fields the next day. Is there a built-in way in Chronoforms to pull up a past database entry into the form, then allow the user to re-submit it in such a way that the database entry is updated?

If this is not built-in, does anyone have suggestions for the best way to implement this (ie. should I just try to mess with the code so the form inputs contain the old data, then do an update SQL command? Or is there a better way with some of the steps already done)?

Thanks!
GreyHead 17 Jul, 2010
Hi garmungo,

Use the Profile Plugin in 'edit' mode.

Bob
garmungo 17 Jul, 2010
Thanks for the help--I was actually just about to edit my post asking about this plugin. I just figured out how to have the form pull in the correct information. However, it seems that when I re-submit the form, an entirely new entry in the database is created, rather than it simply updating the current entry. Is this possible? If so, what am I missing?

Also--I checked a box in the profile plugin saying that I wanted it to evaluate code before doing its routine. Where can I update the code that runs before it does its thing?

Thanks for your help.
GreyHead 17 Jul, 2010
Hi garmungo ,

You need to include the record id in a hidden field in the form if that is already in the table then the record will be updated.

The Evaluate code is I think to run code in the Form HTML.

Bob
garmungo 17 Jul, 2010
Great! Just got it working. Am I correct in thinking that all my pre-form-load code additions need to go into the form html? Or is there another place (like a beforeFormLoad function) that I can have code run beforehand?

The thing is, I am planning on having some validation checks/etc. to make sure someone's not trying to modify an entry with a non-existent id, and that no one's trying to modify an entry they themselves didn't submit. Also--is there a built-in way to do this, or am I correct in thinking I would have to write this stuff myself?

Thanks again.
GreyHead 18 Jul, 2010
Hi garmungo,

They all need to go into the Form HTML. You probably just need to check the User ID and redirect if it isn't valid. Search here on getUser for some examples.

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