Form ID as hidden field
-
I have multiple forms on my website and I want them to be prefilled by the logged-in user’s last entries everytime they load the page.
CF7DB saves contact forms entries to the database. I handle the data query in functions.php in my child theme. On form loading, using the prefill hook, I get the user’s last record from “_db7_forms” table and return it. BUT if the user submits form A and then tries to open form B, it returns the last entries of form A!
I can fix it:
* if I Have a hidden field to send form key. Then I can iterate through rows to find the last entry that is corresponded to the form. Please let me know if there is a tag to get the form key as a hidden field.
* If I can get the ‘from_post_id’ in function.php, when ‘cf7sg_prefill_form_fields’ is applied. (post id as argument)
But right now, there is no obvious way to find the right data entry. Hook has “cf7_key” which is not in DB and records have ‘from_post_id’ which is not in filter arguments.
please guide me if you have a solution.|
Thank you very much.
- The topic ‘Form ID as hidden field’ is closed to new replies.