IMPORTANT UPDATE: Please DOWNLOAD and update the Formidable PRO2PDF to the Latest Version!

Split Form Field Values into multiple fields in PDF

Home Forums Feature Requests Split Form Field Values into multiple fields in PDF

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #17522 Reply
    grhythm
    Participant

    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!

    #17525 Reply
    admin
    Keymaster

    There 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.

    #17535 Reply
    grhythm
    Participant

    Let 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.

    #17540 Reply
    admin
    Keymaster

    We 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;
     }
    #17541 Reply
    grhythm
    Participant

    Great! I will try it. Is there a new version of the plugin to download? I can’t see to find it. thanks!!!

    #17542 Reply
    admin
    Keymaster

    Yes, there was an update to the plugin, update from the WP plugins tab.

    We remain at your service.

    #17543 Reply
    grhythm
    Participant

    It Works!! AMAZING!
    Now, I can create other formats based off of this.
    Thank you SOOO MUCH!!!

Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: Split Form Field Values into multiple fields in PDF
Your information: