Home › Forums › Feature Requests › Split Form Field Values into multiple fields in PDF
- This topic has 6 replies, 2 voices, and was last updated 7 years ago by grhythm.
-
AuthorPosts
-
grhythmParticipant
Hi, so far this has been amazing!
Now, I have many fields that are easier for our users to enter into one field. However, the end result PDF requires these in separate fields. Is it possible to split the value of a field? For instance, I have a input field called ‘Height in feet and inches’. Is it possible to split that value using PHP or javascript? I would like ‘feet’ to go into one field and ‘inches’ into another. We could use a comma or other type of separator. This would be awesome if it was a choice under the format options. Thanks!
adminKeymasterThere are no options in Formidable to split the values of a field, therefore there are no options in PRO2PDF. You would need to use javascript or PHP to split the values into hidden fields before saving the entry, then map the hidden fields to the PDF fields. We do not offer Javascript or PHP support.
We remain at your service.
grhythmParticipantLet me rephrase the question. Under the Field Map Format option, you already allow a lot if different types of formats such as dates ad telephone. I am wondering if you could make it so we could create our own format? This would be super powerful. Thanks for listening.
adminKeymasterWe have updated the plugin to accept this hook in functions.php or code snippet. Just change the commented value below…
add_filter('fpropdf_wpfx_extract_fields', 'fpropdf_wpfx_extract_fields_updated', 10, 2); function fpropdf_wpfx_extract_fields_updated($fields, $entry) { if (isset($entry->form_id) && $entry->form_id == '9') { //change 9 to the Form ID $exploded = array(); foreach ($fields as $key => $field) { $index = $field[0]; $value = $field[1]; if ($index == 'm9hvnr') { //change m9hvnr to the name of the 1st PDF form field $exploded = explode(",", $value); //change , to the data separator used in the Formdiable Form Field if (isset($exploded['0'])) { $fields[$key][1] = $exploded['0']; } } } foreach ($fields as $key => $field) { $index = $field[0]; $value = $field[1]; if ($index == '2ebjab') { //change 2ebjab to the name of the 2nd PDF form field if (isset($exploded['1'])) { $fields[$key][1] = $exploded['1']; } } } } return $fields; }
grhythmParticipantGreat! I will try it. Is there a new version of the plugin to download? I can’t see to find it. thanks!!!
adminKeymasterYes, there was an update to the plugin, update from the WP plugins tab.
We remain at your service.
grhythmParticipantIt Works!! AMAZING!
Now, I can create other formats based off of this.
Thank you SOOO MUCH!!! -
AuthorPosts