Display only the first letter of field value

Formidable Forms
November 20, 2019 13:29:34
dadamos
Topics: 3
Messages: 7
Hi,
I'm using formidable forms and have a text input field for the user to enter his name.
Is there a way somehow to display only his initial (first letter) in the corresponding PDF form output instead of the full name?

Thanks,
Dimitrios
November 20, 2019 17:53:26
E2Pdf
Topics: 7
Messages: 3614
Support
Hi,

Do you have combined value inside PDF field where you need to show only first letter? If yes, unfortunately there is no built-in function to cut "string" but we will check the possibility to add this functionality in future updates.

If you have all names in English, you can try to use this "hack":

[e2pdf-format-output search="a|||b|||c|||d|||e|||f|||g|||h|||i|||j|||k|||l|||m|||n|||o|||p|||q|||r|||s|||t|||u|||v|||w|||x|||y|||z" ireplace="A-|||B-|||C-|||D-|||E-|||F-|||G-|||H-|||I-|||J-|||K-|||L-|||M-|||N-|||O-|||P-|||Q-|||R-|||S-|||T-|||U-|||V-|||W-|||X-|||Y-|||Z-" explode="-" output="{0}"][592][/e2pdf-format-output]

* where [592] is the ID of field. It will replace name "Test" to "T-E-S-T-", explode it and will output only first letter.

Another solution will be to use PHP hooks to update value among render.

P.S. If first letter must be located in separated PDF field, let us know please, there is another solution to cut it, with "preg_replace" or just limit characters for PDF field.

We remain at your service.

We would really appreciate your feedback at WordPress.org!
November 20, 2019 18:56:08
dadamos
Topics: 3
Messages: 7
Thank you for your answer.

I would like to have both the full name and the initial in the same page, in separate places. Is this possible by using the same 'formidable form' field, e.g. using the 'limit characters' control in one place while displaying the full name in the other?

Regards,

D.
November 20, 2019 19:21:15
E2Pdf
Topics: 7
Messages: 3614
Support
Just to be sure that we are understanding the task correctly, we need please a bit more information how is organized input in your Formidable Form and how you need to display data in PDF.

1. Are "First Name" and "Last Name" of your Formidable Form separated fields? If possible, attach please screenshot for this part of form where "First Name" and "Last Name" field(s) located.

2. Can you also please attach screenshot what output you are getting now in PDF and make some notes how it must be changed.

Thank you.

We remain at your service.

We would really appreciate your feedback at WordPress.org!
November 20, 2019 23:06:06
dadamos
Topics: 3
Messages: 7
Previously you mentioned that it could be done either by using the "preg_replace" or by limiting characters for PDF field. Could you please elaborate? If I set the 'Length' of the field to '1', would it be enough?
I am looking for a 'neat' way to display only the first letter of the value of a field in the PDF output.
Thanks once more.
November 21, 2019 06:26:32
E2Pdf
Topics: 7
Messages: 3614
Support
Hi,

Yes, it must be enough. Value will be shorten to first symbol. Screenshot attached.

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.