The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
|
Allowing users to update an existing form record - Printable Version +- Form Tools (https://forums.formtools.org) +-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1) +--- Forum: API (https://forums.formtools.org/forumdisplay.php?fid=17) +--- Thread: Allowing users to update an existing form record (/showthread.php?tid=1731) |
Allowing users to update an existing form record - arunrajv - Oct 31st, 2011 Hello, I am a newcomer to formtools wondering about how to implement the following scenario. The users create the forms through an initial registration - this is not a problem. What I want to do is to allow them to use the same user interface to update their data. They will login through an email ID /password combination, the form fields will be filled with the existing data, and they proceed to update the data just as they did while creating it. I have taken a look at Submission Accounts module, but it seems to present it's own UI (which I believe can be customized?). But I would like to use the same custom UI with which the form was created. I have also looked at ft_update_submission(.), but it seems to expect the $infohash parameter to come from the update submissions page in the admin panel (please correct me if I'm wrong!). Here is the current solution that I have in mind: - The user enters the email ID and password. - I use ft_search_submissions to validate the login and retrieve records. - I fill the form fields with the retrieved values. - Instead of calling ft_api_process_form(.), I call my own function, myft_update_form($form_id, $submission_id, $data) to update the table. I of course have to name the DB columns etc. to sensible values using smart fill for this to work and deal with the DB directly. My question: is there a cleaner way to do what I am trying to achieve through the API? The problem with bypassing the API entirely is that I have to manually do all the bookkeeping (such as modification date) that the API takes care of. Thanks, Arun RE: Allowing users to update an existing form record - arunrajv - Oct 31st, 2011 An update: I have hit upon what's hopefully a minor hack that involved modifying the API a little. The modification is to pass the $submission_id while calling ft_api_init_form_page(.) the FIRST time, and creating a blank submission only if $submission_id is not set. If it is, I use the $submission_id directly. Seems to work so far (cross fingers!). In ft_api_init_form_page(.) Code: function ft_api_init_form_page($form_id = "", $mode = "live", $namespace = "form_tools_form", $submission_id = false) |