• Resolved cotp

    (@cotp)


    Hello,

    I have tried to follow your instructions for creating my first custom template.

    I have a question concerning the data fields

    On your site you have a code that goes like this:

    <?php	
    
    foreach($lead_ids as $lead_id) {
    
                $lead = RGFormsModel::get_lead($lead_id);
                do_action("gform_print_entry_header", $form, $lead);
                $form_data = GFPDFEntryDetail::lead_detail_grid_array($form, $lead);
    
                /** Uncomment the following line when figuring out how to access the $form_data array */
                //print_r($form_data); exit();          
    
                /* get all the form values */
                $date_created       = $form_data['date_created'];
    
              $first_name         = $form_data['field']['1.Name']['first'];
                $last_name          = $form_data['field']['1.Name']['last'];            
    
                $address_street     = $form_data['field']['4.Address']['street'];
                $address_city       = $form_data['field']['4.Address']['city'];
                $address_state      = $form_data['field']['4.Address']['state'];
                $address_zip        = $form_data['field']['4.Address']['zip'];
                $address_country    = $form_data['field']['4.Address']['country'];
    
                $phone              = $form_data['field']['5.Phone'];
                $email              = $form_data['field']['2.Email'];
                $website            = $form_data['field']['3.Website'];     
    
                $signature          = $form_data['signature'][0];
    
                /* format the template */
                ?>

    How can I replace them with the code of my own form ?

    I tried to look in the source code of my form and found
    <input name='input_2' id='input_1_2' ...

    so I tried with $form_data[‘input_2’] and also $form_data[‘input_1_2’]
    but it didn’t work :/

    Am I doing something wrong, or missing something ?

    Thanks in advance for your help

    http://ww.wp.xz.cn/plugins/gravity-forms-pdf-extended/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Jake Jackson

    (@blue-liquid-designs)

    Hi Copt,

    The template you have pasted is actually a version 2 template. The current release is v3.1.3. If you are still running v2.x please upgrade to the latest release.

    If you are running v.3.x.x then please read our extensive documentation on generating a custom template – http://gravityformspdfextended.com/documentation-v3-x-x/templates/getting-started/. That should help you get started.

    Thread Starter cotp

    (@cotp)

    Hello Blue Liquid and thanks for answering back.

    I took the code from that page:
    http://gravityformspdfextended.com/documentation/examples/custom-template/

    I was not clear for me it was from an old version of the plugin, maybe I misunderstood :/ I just used that code since it was on that page as an example.

    I will try again and let you know.

    Also you mention somewhere that we can use the parameter data=1 to show the fileds name in admin mode but I could not get that working…

    I used it when I preview the form, maybe I did something wrong ?

    Thread Starter cotp

    (@cotp)

    I managed to get my arrays :), the mistake I was making is I was using the default template… ^^

    So now I finally have

    Array
    (
        [form_id] => 1
        [entry_id] => 1
        [form_title] => Exemple
        [date_created] => 27/7/2013
        [date_created_usa] => 7/27/2013
        [field] => Array
            (
                [2.First question] => 100
                [2] => 100
                [First question] => 100
                [3.Second question] => 30
                [3] => 30
                [Second question] => 30
                [4.Third question] =>
                [4] =>
                [Third question]] =>
            )
    
    )

    I tried to put:

    /* get all the form values */
    			$date_created		= $form_data['date_created'];
    
    			$field2	= $form_data['2.First question']['2'];
    			$field3	= $form_data['3.Second question']['3'];
    			$field4	= $form_data['4.Third question']['4'];	
    
    			/* format the template */

    But I get MYSQL errors

    Notice: Undefined index: 2.First question in
    C:\wamp\www\mydomain.com\wp-content\plugins\gravity-forms-pdf-extended\templates\default-template.php on line 80
    Notice: Undefined index: 3.Second question in
    C:\wamp\www\mydomain.com\wp-content\plugins\gravity-forms-pdf-extended\templates\default-template.php on line 81
    Notice: Undefined index: 4.Third question in
    C:\wamp\www\mydomain.com\wp-content\plugins\gravity-forms-pdf-extended\templates\default-template.php on line 83

    Any idea ?

    Thread Starter cotp

    (@cotp)

    Ahhhhh searching on your forum, I managed to do it that way

    $field2	=  $form_data['field']['2'];
    			$field3	=  $form_data['field']['3'];
    			$field4	=  $form_data['field']['4'];

    Cool 🙂

    Plugin Author Jake Jackson

    (@blue-liquid-designs)

    Hi cotp,

    I’m glad you got it working.

    For future reference, we’ve archived the v2.x.x documentation. If you look at the top of the link you posted you will see ‘The v2.x.x documentation has been archived as v3.x.x of the software has been released.’, with a link to the new documentation.

    Yes. You can only use the data=1 parameter on custom templates.

    As a reference, the custom template introduction page of the documentation – http://gravityformspdfextended.com/documentation-v3-x-x/templates/getting-started/ – gives you an overview of the $form_data structure.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Creating first custom template’ is closed to new replies.