Showing checkbox values in print-out

WordPress
September 23, 2020 18:44:01
meadmin
Topics: 2
Messages: 2
I have attached an example. We have a form, where some questions are answered by selecting one or more checkboxes. Those values are being stored in the database as arrays. E2PDF appears to be just printing what is in the database instead of the reader-friendly values. How can we configure it to use the reader-friendly values?

We created the form using Toolset in WordPress.
September 24, 2020 09:39:04
E2Pdf
Topics: 7
Messages: 3614
Support
Unfortunately E2Pdf has not yet native support of Toolset, however it must be possible to solve such task of 1 by the following ways:

E2Pdf currently can navigate via arrays by using "path" attribute on shortcode. To accomplish it with this way you must create "textarea" inside PDF with shortcode that outputs serialized value, as example we will be using: [meta key="wpcf-checkbox-1"]

When you get serialized array you must unserialize it via services like: https://www.unserialize.me/.

In our case serialized value looks like:
a:2:{s:64:"wpcf-fields-checkboxes-option-ed2aa5d6f07e8805136cc5f32f3e77ba-1";a:1:{i:0;s:1:"1";}s:64:"wpcf-fields-checkboxes-option-d41ae1e90e0cdc01acdbc9eb2eb9ab87-1";a:1:{i:0;s:1:"1";}}

So after unserialize operation we get the path to navigate, (dot (.) must be used as delimiter between array keys), it's if you need to output values separately:

[meta key="wpcf-checkbox-1" path="wpcf-fields-checkboxes-option-ed2aa5d6f07e8805136cc5f32f3e77ba-1.0"]
[meta key="wpcf-checkbox-1" path="wpcf-fields-checkboxes-option-d41ae1e90e0cdc01acdbc9eb2eb9ab87-1.0"]

However if you need to output all values in one line, you will need to use custom function filter, which must be added to functions.php to get the list of checkboxes values and "implode" them.

Function example that must be added to functions.php: https://codeshare.io/Gbbl0w

P.S. Keep attention that it must be changed "key" to yours.

We remain at your service.

We would really appreciate your feedback at WordPress.org!
Get News and Updates
Our monthly newsletter keeps you in the loop, so you'll always be up to date with the latest news and updates about E2Pdf.
* You can update your email subscription preferences here.
All trademarks, service marks, trade names, product names, and logos appearing on this website are the property of their respective owners. The use of trademarks such as Formidable Forms®, Forminator Forms®, Gravity Forms®, JetFormBuilder®, WordPress®, WooCommerce®, WPForms® and others is solely for identification purposes (nominative use) and does not imply any affiliation, sponsorship, or endorsement by the respective trademark holders.
© 2017 - 2026, https://e2pdf.com

We use cookies to collect and analyse information on site performance and usage, to provide social media features and to enhance and customise content and advertisements. By clicking "Accept Selected", you consent to use of selected cookies according to our Cookie Policy.