housein
Forum Replies Created
-
I updated, and it works fine now.
Thank you very much @aurovrata- This reply was modified 9 months, 2 weeks ago by housein.
Did you try to debug the
cf7-grid-layout-public.js
script to see if it is able to find your checkbox values?
It can’t even get the field object except for the first one in the form. Since the remaining fields are null, it can’t confirm their type as input and returns false.
the values are fine both in prefill data and HTML.I don’t think the problem lies with the stored data. The data is fetched correctly, and the variable
cf7sg
is properly filled. The HTML elements are correctly in place. Everything else works fine for other input types, including the first checkbox field. However, for the remaining checkbox fields, ‘$(this)’ is somehow empty.@aurovrata Thank you very much for your response.
As I mentioned before, I’ve checked var cf7sg and the data is there. It’s been correctly loaded and stored in that variable. But it doesn’t change the checkbox’s element status to checked. in other words, it knows which ones should be checked even if form has multiple checkbox fields but it doesn’t visually present them.
It works for the first field if the name is “checkbox” however we still have problems with forms containing more than one checkbox field.
here is an example:
I added some logs in cf7-grid-layout-public.js:
I checked some values:and then submitted the form and reload:
But as you see the rest of the checkboxes are not updated. At this moment this is the cf7sg in the inspector:
var cf7sg = … {“prefill”:{“cfdb7_status”:”unread”,”checkbox”:[“Kirsten Dunst”,”Gwyneth Paltrow”,”Abraham Lincoln, ehem. US-Pr\u00e4sident”,”Buzz Aldrin, zweiter Mann auf dem Mond”],”checkbox-2″:[“Jim Carrey”,”Zach Braff”],”checkbox-3″:[“Katy Perry”],”checkbox-4″:[“Sebastian Deisler, ehem. Fu\u00dfballspieler”],”checkbox-5″:[“J.K. Rowling (Harry Potter)”]}…}
and this is the console:I don’t understand why and how the $field at the first call has all the checkboxes and none later.
@aurovrata I’d appreciate your help with the “prefill checkboxes” problem and guidance on implementing the “prefill the form with last user entries” using the “Post My CF7” plugin. I’m under time pressure, so your prompt feedback will be greatly valued.
P.S. If I have only one checkbox field in my form and label it exactly “checkbox,” it works. Otherwise, the $field in $.fn.prefillCF7Field in cf7-grid-layout-public.js will be null.
It is specifically designed for saving draft submissions and allowing users to continue where they left off.
Is there any clear guidance on how this can be implemented? We want to prefill form fields with the last entries submitted by the logged-in user for each form.
ok, will need to check this on my test server next week. Will get back to you on this.
Thank you very much. I would appreciate it if you could update me on the test results.
With CF7DB, the data is stored in custom tables, and as such 99% of plugins will not be able to access your data
That’s true. We are strict about the security of our users’ data, so I thought maybe an isolated table could help reduce the risk of data exposure.
It is specifically designed for saving draft submissions and allowing users to continue where they left off.
is there a built-in way to save all form’s fields values (normal and hidden) as post content (in order to export them to CSV file later)?
under Map form fields to default post fields you can only select one field as post content.
I used a cf7_2_post_filter-post-editor to pass the array but it makes it harder later to convert them in a clean table as CSV.Thank you for your prompt response.
did you try my other plugin, the Post My CF7 Form ?
I have it installed already and considering it. But I’ve chosen CF7DB because I found it easier to export recorded data to CSV file.
will need to check this on my test server next week. Will get back to you on this.
Thank you very much. I look forward to your comments on this matter. Meanwhile, I’ll try to run a test with Post My CF7 and see if we can substitute it with CF7DB. with CF7DB.
PS: I handle the data query in functions.php in my child theme.
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. 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 submit form A and then try 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.
But right now there is no clear way to find the right data. 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.thank you very much for your reply and useful information.
I did the job with CF7DB and CF7SG’s hooks.
I’ll definitely check Post My CF7 Form. It seems to be more suitable for what I’m trying to implement. I’ll try it and bother you again with more questions ??
thank you once again for your help and great job with these plugins.I solved the problem.
thank you.Thank you for the reply. Sorry, I assumed those are different pages, this one for CF7 and the other for CF7SG.
But How can I get help with the problem? Is there any solution?
or at least please give me a clue where to share the question?