Display only the first letter of field value

Formidable Forms
20 November, 2019 05: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
20 November, 2019 09:53:26
E2Pdf
Support
Topics: 7
Messages: 3188
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!
20 November, 2019 10: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.
20 November, 2019 11:21:15
E2Pdf
Support
Topics: 7
Messages: 3188
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!
20 November, 2019 15: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.
20 November, 2019 22:26:32
E2Pdf
Support
Topics: 7
Messages: 3188
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!